pointers, dereference pointers using C programming language!
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <math.h>
int main()
{
int i;
int balls[6]={7,9,43,21,3};
printf("Element \t Address \t\t Value \n");
for(i=0;i<6;i++){
printf("balls[%d] \t %p \t %d \n",i,&balls[i],balls[i]);
}
//array names are pointers of the first elemnt
printf("\nballs \t\t %p \n",balls);
//dereference the subject
printf("\n*balls \t\t %d \n",*balls);
printf("\n*(balls+2) \t %d \n",*(balls+2));
printf("\n*(balls+2) \t %p \n",&*(balls+2));
return 0;
}
Comments
Post a Comment