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


Please Help Members By Posting Answers For Below Questions

Explain how can you be sure that a program follows the ansi c standard?

852


Explain the properties of union. What is the size of a union variable

710


What are disadvantages of C language.

638


List a few unconditional control statement in c.

553


Create a structure to specify data on students given below: Roll number, Name, Department, Course, Year of joining Assume that there are not more than 450 students in the college. 1.write a function to print names of all students who joined in a particular year 2.write a function to print the data of a student whose roll number is given

2504






What are the 32 keywords in c?

623


When should volatile modifier be used?

544


Explain how can I make sure that my program is the only one accessing a file?

614


find the value of y y = 1.5x+3 for x<=2 y = 2x+5 for x>2

1521


how to find anagram without using string functions using only loops in c programming

2709


Which one to choose from 'initialization lists' or 'assignment', for the use in the constructor?

556


What is a list in c?

610


Does * p ++ increment p or what it points to?

602


What are enums in c?

651


What is function definition in c?

576