ProgrammingEasyTCS NQT · Infosys pattern
The end of a C string is marked by:
- A. The EOF macro
- B. A length stored in the first byte
- C. The null character '\0'
- D. The newline character '\n'
Correct answer: C. The null character '\0'
A C string is a char array terminated by '\0' (value 0). Library functions such as strlen and printf("%s") stop at that byte; C stores no length.
More C Programming questions
- Which declaration makes p a pointer to an int?
- A line such as #include <stdio.h> is processed by:
- Which printf format specifier is meant for printing a pointer value (an address)?
- What is printed? c printf("%d", 10 / 3 3);
- What is printed? c int a = 5, b; b = a++ + 10; printf("%d %d", a, b);
- What is printed? c char s[] = "placement"; printf("%zu %zu", sizeof(s), strlen(s));