Is the following code legal?

void main()


typedef struct a aType;

aType someVariable;

struct a


int x;

aType *b;



Is the following code legal? void main() { typedef struct a aType; aTy..

Answer / susie

Answer :



When the declaration,

typedef struct a aType;

is encountered body of struct a is not known. This is known
as ‘incomplete types’.

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More C Code Interview Questions

struct aaa{ struct aaa *prev; int i; struct aaa *next; }; main() { struct aaa abc,def,ghi,jkl; int x=100; abc.i=0;abc.prev=&jkl;; def.i=1;def.prev=&abc;; ghi.i=2;ghi.prev=&def;; jkl.i=3;jkl.prev=&ghi;;>next->prev->next->i; printf("%d",x); }

1 Answers  

main() { int i, j; scanf("%d %d"+scanf("%d %d", &i, &j)); printf("%d %d", i, j); } a. Runtime error. b. 0, 0 c. Compile error d. the first two values entered by the user

2 Answers   HCL,

Code for 1>"ascii to string" 2>"string to ascii"

1 Answers   Aricent, Global Logic,

All the combinations of prime numbers whose sum gives 32

1 Answers   HHH,

Print an integer using only putchar. Try doing it without using extra storage.

2 Answers  

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

2 Answers  

How do you write a program which produces its own source code as its output?

7 Answers  

main() { int i=5,j=6,z; printf("%d",i+++j); }

2 Answers  

main() { int i = 0xff ; printf("\n%d", i<<2); } a. 4 b. 512 c. 1020 d. 1024

2 Answers   HCL,

Is this code legal? int *ptr; ptr = (int *) 0x400;

1 Answers  

main() { int a=2,*f1,*f2; f1=f2=&a; *f2+=*f2+=a+=2.5; printf("\n%d %d %d",a,*f1,*f2); }

6 Answers  

#include <stdio.h> main() { char * str = "hello"; char * ptr = str; char least = 127; while (*ptr++) least = (*ptr<least ) ?*ptr :least; printf("%d",least); }

1 Answers