What will be the result of the following program?
main()
{
char p[]="String";
int x=0;
if(p=="String")
{
printf("Pass 1");
if(p[sizeof(p)-2]=='g')
printf("Pass 2");
else
printf("Fail 2");
}
else
{
printf("Fail 1");
if(p[sizeof(p)-2]=='g')
printf("Pass 2");
else
printf("Fail 2");
}
}
a) Pass 1, Pass 2
b) Fail 1, Fail 2
c) Pass 1, Fail 2
d) Fail 1, Pass 2
e) syntax error during compilation
Answer Posted / reepal
e) syntex error during compilation
| Is This Answer Correct ? | 3 Yes | 1 No |
Post New Answer View All Answers
What is the use of static variable in c?
I need previous papers of CSC.......plz help out by posting them.......
What is signed and unsigned?
What are the key features in c programming language?
What's the total generic pointer type?
Why c language?
Can one function call another?
How can you return multiple values from a function?
What's the right way to use errno?
How can I ensure that integer arithmetic doesnt overflow?
What is the function of volatile in c language?
Explain what is meant by high-order and low-order bytes?
Is file a keyword in c?
Write a program to print "hello world" without using a semicolon?
what will be the output for the following main() { printf("hi" "hello"); }