{
char ch[6]="Hello";
printf("Initial decleration is: ch[10]=\"Hello\"\n\n");
printf("Address of &ch=%d\n",&ch);
printf("Address of &ch[0]=%d\n",&ch[0]);
printf("------------\n");
printf("Value in ch where it points to *ch=%d\n",*ch);
printf("Value in ch *(&ch)=%d\n",*(&ch));
}
Output:
Initial declaration is: ch[10]="Hello"
Address of &ch=8832
Address of &ch[0]=8832
------------
Value in ch where it points to *ch=72
Value in ch *(&ch)=8832
-------------------------------------------------------------------------------------
ch[0] ch[1] ch[2] ch[3] ch[4] ch[5]
-------------------------------------------------------------------------------------
H e l l o \0
-------------------------------------------------------------------------------------
8832 8833 8834 8835 8836 8837
-------------------------------------------------------------------------------------
C Language: Scanf and "&" doubt.? - Yahoo! Answers India
-------------------------------------------------------------------------------------
^ considering the above Thread, my question is:
1. where is ch? and address of &ch, are ch and ch[0] both same?
2. how pointer concept is being used here?
3. how come &ch, &ch[0] and value in ch( *(&ch) ) are same?
thank you.


Sign In
Create Account


Back to top









