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));
}
  1. A. 8 4
  2. B. 4 4
  3. C. 8 8
  4. 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

Exams that ask this topic