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
d) Fail 1, Pass 2
Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
Give basis knowledge of web designing ...
When should the register modifier be used? Does it really help?
why return type of main is not necessary in linux
Whats s or c mean?
Are global variables static in c?
what are non standard function in c
write a c program thal will find all sequences of length N that produce the sum is Zero, print all possible solutions?
What are the different file extensions involved when programming in C?
Write a program to produce the following output: 1 2 3 4 5 6 7 8 9 10
Can we increase size of array in c?
What are the back slash character constants or escape sequence charactersavailable in c?
What are the types of variables in c?
What is echo in c programming?
What is console in c language?
Write a function expand(s1,s2) that expands shorthand notations like a-z in the string s1 into the equivalent complete list abc...xyz in s2 . Allow for letters of either case and digits, and be prepared to handle cases like a-b-c and a-z0-9 and -a-z. z-a:zyx......ba -1-6-:-123456- 1-9-1:123456789987654321 a-R-L:a-R...L a-b-c:abbc