Advertisement
Lisaveta777

?Basic Array Pointers

Jul 30th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.47 KB | None | 0 0
  1. #include <stdio.h>
  2. #define SIZE 30
  3.  
  4. int main()
  5. {
  6.     int i;
  7.     char arr[SIZE] = "man man man";
  8.     char *parr,*parr2;
  9.  
  10.     parr = arr;
  11.     for(i=0;i<SIZE;i++)
  12.         printf("%c",*(parr+i));
  13.     printf("\n");
  14.  
  15.     parr2 = parr;
  16.     for(i=0;i<SIZE;i++)
  17.         printf("%c",*(parr2)+i);//crazy output!
  18.     //if arr = "man man man" then starts with arr[0], and goes mnop...
  19.    //if  arr = "cat cat cat" then starts with arr[0], and goes cdef...
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement