ProgrammingModerateTCS NQT · Infosys
What is printed? Assume long is 8 bytes and int is 4 bytes.
What is printed? Assume long is 8 bytes and int is 4 bytes.
#include <stdio.h>
int main(void) {
printf("%zu %zu", sizeof(1L), sizeof(1));
}- A. 8 4
- B. 4 4
- C. 8 8
- D. 4 8
Correct answer: A. 8 4
The literal 1L has type long, which is 8 bytes here, while the plain literal 1 has type int, which is 4 bytes.
More C Programming questions
- What is printed? c #include <stdio.h> int main(void) { printf("%d", 10 / 3 3 + 10 % 3); }
- What is printed? c #include <stdio.h> int main(void) { unsigned char c = 1; printf("%d", -c); }
- What is printed? c #include <stdio.h> #include <string.h> int main(void) { char s[] = "hello"; char p = strchr(s, 'l'); printf("%ld"…
- How many moves does this recursive Towers of Hanoi program make for 4 disks? Compute with the program. c #include <stdio.h> int moves = 0…
- What is printed? c #include <stdint.h> #include <stdio.h> int main(void) { uint8t x = 0x96; uint8t r = (uint8t)((x << 3) | (x >> 5))…
- What is printed? Assume signed char is 8 bits, two's complement. c #include <stdio.h> #include <stdlib.h> int cmp(const void a, const void…