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
write an interactive C program that will encode or decode a line of text.To encode a line of text,proceed as follows. 1.convert each character,including blank spaces,to its ASCII equivalent. 2.Generate a positive random integer.add this integer to the ASCII equivalent of each character.The same random integer will be used for the entire line of text. 3.Suppose that N1 represents the lowest permissible value in the ASCII code,and N2 represents the highest permissible value.If the number obtained in step 2 above(i.e.,the original ASCII equivalent plus the random integer)exceeds N2,then subtract the largest possible multiple of N2 from this number,and add the remainder to N1.Hence the encoded number will always fall between N1 and N2,and will therefore always represent some ASCII character. 4.Dislay the characters that correspond to the encoded ASCII values. The procedure is reversed when decoding a line of text.Be certain,however,that the same random number is used in decodingas was used in encoding.
how could explain about job profile
How to draw the flowchart for structure programs?
Explain what could possibly be the problem if a valid function name such as tolower() is being reported by the c compiler as undefined?
How #define works?
I was asked to write a program in c which when executed displays how many no.of clients are connected to the server.
Do pointers store the address of value or the actual value of a variable?
What is #define used for in c?
Explain how can a program be made to print the name of a source file where an error occurs?
Discuss the function of conditional operator, size of operator and comma operator with examples.
Given an array of 1s and 0s arrange the 1s together and 0s together in a single scan of the array. Optimize the boundary conditions?
Write a program to swap two numbers without using a temporary variable?
Why does the call char scanf work?
largest Of three Number using without if condition?
void main(int n) { if(n==0) return; main(--n); printf("%d ",n); getch(); } how it work and what will be its output...............it any one know ans plz reply