adplus-dvertising
frame-decoration

Question

What is the output of this program?
#include <stdio.h>
int main()
{
    char str = "Hello";
    printf("%s", str);
    return 0;
}

a.

Hello

b.

Base address of str

c.

Segmentation Fault

d.

None of the above

Posted under Strings C Programming

Answer: (c).Segmentation Fault

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of this program?