Put values in the memory locations by using pointers : Variable Pointer « Language « C Tutorial






#include <stdio.h>

main(){
    int a[5];
    int *b;
    int *c;
    int i;
    for(i = 0;i<5;i++){
        a[i]=i;
    }
    for(i = 0;i<5;i++)   {
        printf("value in array %d\n",a[i]);
    }

    b=a;
    b++;
    *b=4;
    b++;
    *b=6;
    b++;
    *b=8;
    b++;
    *b=10;
    b++;
    *b=12;

    printf("after\n\n\n");
    for(i = 0;i<5;i++)   {
        printf("value in array %d\n",a[i]);
    }
}
value in array 0
      value in array 1
      value in array 2
      value in array 3
      value in array 4
      after
      
      
      value in array 0
      value in array 4
      value in array 6
      value in array 8
      value in array 10








1.13.Variable Pointer
1.13.1.Output value at the address
1.13.2.Put values in the memory locations by using pointers