consider the following structure:
struct num nam{
int no;
char name[25];
};
struct num nam
n1[]={{12,"Fred"},{15,"Martin"},{8,"Peter"},{11,Nicholas"}};
.....
.....
printf("%d%d",n1[2],no,(*(n1 + 2),no) + 1);
What does the above statement print?
a.8,9
b.9,9
c.8,8
d.8,unpredictable value

Answers were Sorted based on User's Feedback



consider the following structure: struct num nam{ int no; char..

Answer / jai

Compilation error. Otherwise if rewritten printf statement
is:
printf("%d,%d", n1[2].no, (*(n1+2).no)+1);
then answer is a. 8,9

Is This Answer Correct ?    6 Yes 0 No

consider the following structure: struct num nam{ int no; char..

Answer / santlal kurmi

The correct answer is
a. 8,9
because *(n1+2) means a[2]

Is This Answer Correct ?    4 Yes 0 No

consider the following structure: struct num nam{ int no; char..

Answer / guest

d

Is This Answer Correct ?    3 Yes 0 No

consider the following structure: struct num nam{ int no; char..

Answer / vignesh1988i

the above structure name is an invalid name , since it has encountered a space..... pl. rectify this error, and decleration of array of structure is also not valid...
if this errors are rectified , and we cant refer a structure through ',' operator.... only '.' or -> should be used... so, pl. try to correct it..
the o/p is : 8,9


thank u

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More C Interview Questions

What is oops c?

0 Answers  


What is a C array and illustrate the how is it different from a list.

1 Answers   Amazon,


How can a program be made to print the line number where an error occurs?

0 Answers  


Is c still used?

0 Answers  


write a program to print calender using for loop.

1 Answers   HCL, TCS,






What is the general form of function in c?

0 Answers  


hi , please send me NIC written test papers to sbabavalli@gmail.com

0 Answers   NIC,


What is a structure in c language. how to initialise a structure in c?

0 Answers  


program to find the second largest word in a paragraph amongst all words that repeat more thn twice

4 Answers   CTS, iGate,


How can I copy just a portion of a string?

0 Answers  


How can a number be converted to a string?

1 Answers  


how to capitalise first letter of each word in a given string?

0 Answers  


Categories