C Programming - Pointers - Discussion

Discussion Forum : Pointers - Find Output of Program (Q.No. 7)
7.
What will be the output of the program ?
#include<stdio.h>

int main()
{
    char *str;
    str = "%s";
    printf(str, "K\n");
    return 0;
}
Error
No output
K
%s
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
57 comments Page 5 of 6.

Singh is king said:   1 decade ago
Based on the total var we need to specify scope identifiers.

Bhavin said:   1 decade ago
What we write in double quotes will get printed simple?

Rishi said:   1 decade ago
@Ravi.
Your code is working properly. O/P will be goog.

Mitali said:   10 years ago
@Shahin.

How it will give garbage value as an output?

Satyam said:   9 years ago
Thanks to everyone. Really useful discussion.

Shahin said:   1 decade ago
@Nithiya.

The output will be garbage value.

Santhosh said:   1 decade ago
Hey rajat in turbo it is working properly.

Lavanya said:   1 decade ago
@Kavyashree.

Your ans is exactly correct.

Harsh said:   1 decade ago
@Kavyashree.

You are absolutely correct.

Rajesh Panse said:   1 decade ago
@kavyashree.

You are absolutely right.


Post your comments here:

Your comments will be displayed after verification.