I do not understand how the codes below work
code output : HCode:#include<stdio.h> int main () { char * p = { "Hello"}; printf("%c", *p); return 0; }
Pointer hold memory location of another variable. The program has a variable named pointer
I do not understand how the codes below work
code output : HCode:#include<stdio.h> int main () { char * p = { "Hello"}; printf("%c", *p); return 0; }
Pointer hold memory location of another variable. The program has a variable named pointer
"Hello" is a string constant, so it exists independently of the pointer.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
"Hello" is a string constant because it is a string constant by definition. Likewise, in this program below, 123 is an integer constant because it is an integer constant by definition, no const keyword is necessary:Originally Posted by Player777
Code:#include <stdio.h> int main(void) { printf("%d\n", 123); return 0; }
Last edited by laserlight; 02-15-2020 at 04:06 AM.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)