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

hello sir,is there any function in C that can calculate number of digits in an int type variable,suppose:int a=123; 3 digits in a.what ll b answer?

6 Answers  

main( ) { int a[2][3][2] = {{{2,4},{7,8},{3,4}},{{2,2},{2,3},{3,4}}}; printf(“%u %u %u %d \n”,a,*a,**a,***a); printf(“%u %u %u %d \n”,a+1,*a+1,**a+1,***a+1); }

2 Answers  

Is the following code legal? typedef struct a aType; struct a { int x; aType *b; };

1 Answers  

int swap(int *a,int *b) { *a=*a+*b;*b=*a-*b;*a=*a-*b; } main() { int x=10,y=20; swap(&x,&y); printf("x= %d y = %d\n",x,y); }

1 Answers  

const int perplexed = 2; #define perplexed 3 main() { #ifdef perplexed #undef perplexed #define perplexed 4 #endif printf("%d",perplexed); } a. 0 b. 2 c. 4 d. none of the above

1 Answers   HCL, emc2,

What is data _null_? ,Explain with code when u need to use it in data step programming ?

0 Answers   Abbott,

main() { static char names[5][20]={"pascal","ada","cobol","fortran","perl"}; int i; char *t; t=names[3]; names[3]=names[4]; names[4]=t; for (i=0;i<=4;i++) printf("%s",names[i]); }

2 Answers  

Cluster head selection in Wireless Sensor Network using C programming language.

0 Answers  

All the combinations of prime numbers whose sum gives 32

1 Answers   HHH,

void main() { int k=ret(sizeof(float)); printf("\n here value is %d",++k); } int ret(int ret) { ret += 2.5; return(ret); }

1 Answers  

Printf can be implemented by using __________ list.

3 Answers  

#include<stdio.h> main() { char s[]={'a','b','c','\n','c','\0'}; char *p,*str,*str1; p=&s[3]; str=p; str1=s; printf("%d",++*p + ++*str1-32); }

2 Answers   CNSI,