Home » C Programming » Strings

What will be the output of the program? #include #include int main() { char str[] = "India\0\CURIOUSTAB\0"; printf("%s\n", str); return 0; }

Correct Answer: India

Explanation:

A string is a collection of characters terminated by '\0'.


Step 1: char str[] = "India\0\CURIOUSTAB\0"; The variable str is declared as an array of characters and initialized with value "India"


Step 2: printf("%s\n", str); It prints the value of the str.


The output of the program is "India".


← Previous Question Next Question→

More Questions from Strings

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion