ExamVeda
Login
Home
This question belongs to C Program Arrays And Strings
Arrays and Strings
?

What will be the output of the program?
#include<stdio.h>
#include<string.h>
void main()
{
    char str[] = "Exam\0Veda";
    printf("%s", str);
}

Answer & Solution
Correct Answer: Option A

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

>> char str[] = "Exam\0\Veda\0"; The variable str is declared as an array of characters and initialized with value "Exam".

>> printf("%s", str); It prints the value of the str.
The output of the program is "Exam".

Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.