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
c)Pass 1, Fail 2
Is This Answer Correct ? | 1 Yes | 2 No |
Post New Answer View All Answers
What are the types of operators in c?
How old is c programming language?
Does free set pointer to null?
What is the difference between struct and typedef struct in c?
Why do we write return 0 in c?
Explain how do you convert strings to numbers in c?
How can I get back to the interactive keyboard if stdin is redirected?
How can you check to see whether a symbol is defined?
Explain what is the concatenation operator?
What is the difference between specifying a constant variable like with constant keyword and #define it? i.e what is the difference between CONSTANT FLOAT A=1.25 and #define A 1.25
Are the outer parentheses in return statements really optional?
What are the valid places to have keyword “break”?
How can you read a directory in a C program?
What are extern variables in c?
Write a C program to help a HiFi’s Restaurant automate its breakfast billing system. Your assignment should implement the following items: a. Show the customer the different breakfast items offered by the HiFi’s Restaurant. b. Allow the customer to select more than one item from the menu. c. Calculate and print the bill to the customer. d. Produce a report to present your complete program and show more sample output. Assume that the HiFi’s Restaurant offers the following breakfast menu: Plain Egg $2.50 Bacon and Egg $3.45 Muffin $2.20 French Toast $2.95 Fruit Basket $3.45 Cereal $0.70 Coffee $1.50 Tea $1.80