Possible Duplicates:
C: differences between pointer and array
Different sizeof results
Basically, I did this...
char *str1 = "Sanjeev"; char str2[] = "Sanjeev"; printf("%d %d\n",strlen(str1),sizeof(str1)); printf("%d %d\n",strlen(str2),sizeof(str2)); and my output was
7 4 7 8 I'm not able to give reasons as to why the sizeof str1 is 4. Please explain the difference between these.
7 8 / 7 8; it is a 64-bit machine, of course. This would probably have misled you about what is going on!