C语言指针与1维数组


C语言指针与一维数组

代码如下:<br />

  #include <stdio.h> #include <stdlib.h> int main(void) { char hello[] = {'h', 'e', 'l', 'l', 'o'}; char *p = hello; //printf("%s\n", hello); printf("hello is : %x\n", hello); printf("&hello is : %x\n", &hello); printf("&hello[0] is : %x\n", &hello[0]); printf("p is : %x\n", p); printf("&(*p) is : %x\n", &(*p)); printf("*(&p) is : %x\n", *(&p)); printf("&p is : %x\n", &p); return EXIT_SUCCESS; }


输出结果:

  hello is : 22ff4b &hello is : 22ff4b &hello[0] is : 22ff4b p is : 22ff4b &(*p) is : 22ff4b *(&p) is : 22ff4b &p is : 22ff44


c语言 指针 程序开发

无限剑制EX 13 years, 10 months ago

Your Answer