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; }Single choice
A
5, 8
B
6, 8
C
10, 20
D
8, 5
Log in for full answers
We've collected over 50,000 authentic original questions and detailed explanations from around the globe. Log in now and get instant access to the answers!
Similar Questions
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; }
More Practical Tools for Students Powered by AI Study Helper
Making Your Study Simpler
Join us and instantly unlock extensive past papers & exclusive solutions to get a head start on your studies!