Home » C Programming » Strings

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

Correct Answer: Cannot predict

Explanation:

Here str[] has declared as 7 character array and into a 8 character is stored. This will result in overwriting of the byte beyond 7 byte reserved for '\0'.

← Previous Question

More Questions from Strings

Discussion & Comments

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