MUstar

IoT C언어 0626 - No.1

Jun 26th, 2017
62
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2.  
  3. int main(void)
  4. {
  5.     int ary[3];
  6.     int *pa = ary;
  7.     int i;
  8.  
  9.     *pa = 10;
  10.     *(pa + 1) = 20;
  11.     pa[2] = pa[0] + pa[1];
  12.     printf("pa[2] = %d\n",pa[2]);
  13.     *(pa+2) = *(pa+0) + *(pa+1);
  14.     printf("*(pa+2) = %d\n",*(pa+2));
  15.     *(ary+2) = *(ary+0) + *(ary+1);
  16.     printf("*(ary+2) = %d\n",*(ary+2));
  17.     ary[2] = ary[0] + ary[1];
  18.     printf("ary[2] = %d\n",ary[2]);
  19.  
  20.     for(i=0;i<3;i++)
  21.     {
  22.         printf("%5d", pa[i]);
  23.     }
  24.  
  25.     return 0;
  26. }
RAW Paste Data