what wud be the output?
main()
{
char *str[]={
"MANISH"
"KUMAR"
"CHOUDHARY"
};
printf("\nstring1=%s",str[0]);
printf("\nstring2=%s",str[1]);
printf("\nstring3=%s",str[2]);
a)string1=Manish
string2=Kumar
string3=Choudhary
b)string1=Manish
string2=Manish
string3=Manish
c)string1=Manish Kumar Choudhary
string2=(null)
string3=(null)
d)Compiler error
Answer Posted / rakesh soni
c)string1=Manish Kumar Choudhary
string2=(null)
string3=(null)
Bcoz, at the time of initialization, we are giving "mainsh"
"kumar" "choudhary", which is not comma seprated. so "Manish
kumar choudhary" string goes on to 0 position of the array
of char pointer. rest of 2 string have null.
| Is This Answer Correct ? | 11 Yes | 1 No |
Post New Answer View All Answers
Can two or more operators such as and be combined in a single line of program code?
Can a pointer be static?
Is c dynamically typed?
Why do we use main function?
Where can I get an ansi-compatible lint?
What is the difference between scanf and fscanf?
Want to know how to write a C program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.
how to print the character with maximum occurence and print that number of occurence too in a string given ?
What is #define in c?
Explain what is the difference between a free-standing and a hosted environment?
Is c easier than java?
What is a wrapper function in c?
What is the value of uninitialized variable in c?
Why c is faster than c++?
#define PRINT(int) printf("int = %d ",int) main() {< BR> intx,y,z; x=03;y=02;z=01; PRINT(x^x); z<<=3;PRINT(x); y>>=3;PRINT(y); }