Is the following code legal?

struct a

{

int x;

struct a b;

}



Is the following code legal? struct a { int x; struct a b;..

Answer / susie

Answer :

No

Explanation:

Is it not legal for a structure to contain a member
that is of the same

type as in this case. Because this will cause the structure
declaration to be recursive without end.

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More C Code Interview Questions

main() { char *p="GOOD"; char a[ ]="GOOD"; printf("\n sizeof(p) = %d, sizeof(*p) = %d, strlen(p) = %d", sizeof(p), sizeof(*p), strlen(p)); printf("\n sizeof(a) = %d, strlen(a) = %d", sizeof(a), strlen(a)); }

1 Answers  


WAP to display 1,2,3,4,5........N

2 Answers  


How to swap two variables, without using third variable ?

104 Answers   AB, ADP, BirlaSoft, Cisco, Cygnet Infotech, HCL, Hewitt, Honeywell, HP, IBM, Infosys, Manhattan, Microsoft, Mobius, Percept, Satyam, SofTMware, TCS, Wipro, Yamaha,


#define prod(a,b) a*b main() { int x=3,y=4; printf("%d",prod(x+2,y-1)); }

1 Answers  


how can i search an element in an array

2 Answers   CTS, Microsoft, ViPrak,






write a simple calculator c program to perform addition, subtraction, mul and div.

0 Answers   United Healthcare, Virtusa,


Find your day from your DOB?

15 Answers   Accenture, Microsoft,


1 o 1 1 0 1 0 1 0 1 1 0 1 0 1 how to design this function format in c-language ?

2 Answers  


to remove the repeated cahracter from the given caracter array. i.e.., if the input is SSAD output should of SAD

6 Answers   Synergy,


How to use power function under linux environment.eg : for(i=1;i<=n;i++){ pow(-1,i-1)} since it alerts undefined reference to 'pow'.

2 Answers  


What is the main difference between STRUCTURE and UNION?

13 Answers   HCL,


Write a program to model an exploding firecracker in the xy plane using a particle system

0 Answers   HCL,


Categories