#include<stdio.h>
#include<conio.h>
void main()
{
char cr[] = "Yash";
clrscr();
printf("%p\n",(void*)cr);
printf("%p\n",cr);
printf("%p\n",&cr);
printf("%p\n",&cr[0]);
printf("%p\n",cr[0]);
printf("%p\n",(void*)cr[0]);
printf("%c\n",&cr[0]);
printf("%s\n",&cr);
printf("%c\n",(void*)cr[0]);
printf("%s\n",(void*)cr);
getch();
}
Output:
FFEE
FFEE
FFEE
FFEE
0059
0059
ε
Yash
Y
Yash
Question:
I fail to understand exactly the output which I get in this code. Can somebody please explain each output why is it the way it is. Especially why does printf("%c",&cr[0]);
give some sought of ε
this weird or may be be null symbol?
And why are outputs of (void*)cr[0]
and cr[0]
different from the other 3 in the half of %p
? If they are just addresses then why different?(I am really really sorry for the last minute changes I made:/)