What is the output of this C program (assume a pointer is 8 bytes)? #include <stdio.h> #include <string.h> int main() { char *str = "Hello"; printf("%ld, %ld\n", strlen(str), sizeof(str)); return 0; }单项选择题
A
5, 8
B
6, 8
C
10, 20
D
8, 5
登录即可查看完整答案
我们收录了全球超50000道真实原题与详细解析,现在登录,立即获得答案。
类似问题
What is the output (to stdout) of this C code, assuming all these lines will execute on the CPU uninterrupted? (assume p has address 1314)
What does this C code print (assume a pointer is 8 bytes)? int main() { char arr[] = {1, 2, 3}; char *p = arr; printf(" %d ", sizeof(p)); printf(" %d ", sizeof(arr)); }
What is the output of this C program? #include<stdio.h> #include<stdlib.h> int main() { int *ptr; ptr = (int *)calloc(1,sizeof(int)); printf("%d\n",*ptr); return 0; }
What are the problems with this C program? Select two. #include<stdio.h> #include<stdlib.h> int main() { int *ptr; *ptr = 0; printf("%d\n",*ptr); *ptr = 1; printf("%d\n",*ptr); return 1; }
更多留学生实用工具
希望你的学习变得更简单
加入我们,立即解锁 海量真题 与 独家解析,让复习快人一步!