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 / vinay deore
Fail 1,Fail 2
| Is This Answer Correct ? | 0 Yes | 2 No |
Post New Answer View All Answers
What's the right way to use errno?
What are c header files?
Explain what are the different data types in c?
What is self-referential structure in c programming?
Explain the difference between null pointer and void pointer.
Explain the term printf() and scanf() used in c language?
how can i write a program that prints out a box such that whenever i press any key8(coordinate number) on the keyboard, the box moves.
What is the difference between #include and #include 'file' ?
Is fortran still used in 2018?
What is a good way to implement complex numbers in c?
write a C program: To search a file any word which starts with ?a?. If the word following this ?a? starts with a vowel.Then replace this ?a? with ?a? with ?an?. redirect with the output onto an output file.The source file and destination file are specified by the user int the command line.
why we wont use '&' sing in aceesing the string using scanf
What is function and its example?
using for loop sum 2 number of any 4 digit number in c language
How can I write a function analogous to scanf?