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 / guest
Fail 1,Fail 2
Is This Answer Correct ? | 0 Yes | 2 No |
Post New Answer View All Answers
What is a const pointer?
Can i use “int” data type to store the value 32768? Why?
The file stdio.h, what does it contain?
How do you print an address?
What is call by reference in functions?
What is the use of extern in c?
What are the advantages of using macro in c language?
What are reserved words?
What is the difference between typedef and #define?
How can I implement sets or arrays of bits?
What is an auto keyword in c?
Is register a keyword in c?
Can a local variable be volatile in c?
Can two or more operators such as and be combined in a single line of program code?
What does the message "automatic aggregate intialization is an ansi feature" mean?