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 :

No

Explanation:

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 ?    2 Yes 1 No

Post New Answer

More C Code Interview Questions

What is the output for the following program main() { int arr2D[3][3]; printf("%d\n", ((arr2D==* arr2D)&&(* arr2D == arr2D[0])) ); }

1 Answers  


Write a program that reads a dynamic array of 40 integers and displays only even integers

2 Answers  


main() { extern int i; i=20; printf("%d",sizeof(i)); }

2 Answers  


int DIM(int array[]) { return sizeof(array)/sizeof(int ); } main() { int arr[10]; printf(“The dimension of the array is %d”, DIM(arr)); }

2 Answers   CSC,


what will be the position of the file marker? a: fseek(ptr,0,SEEK_SET); b: fseek(ptr,0,SEEK_CUR);

2 Answers  






main() { int i; clrscr(); printf("%d", &i)+1; scanf("%d", i)-1; } a. Runtime error. b. Runtime error. Access violation. c. Compile error. Illegal syntax d. None of the above

1 Answers   HCL,


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

1 Answers  


how to swap 3 nos without using temporary variable

4 Answers   Satyam,


What are the files which are automatically opened when a C file is executed?

1 Answers  


Printf can be implemented by using __________ list.

3 Answers  


void main() { int c; c=printf("Hello world"); printf("\n%d",c); }

2 Answers  


What is the subtle error in the following code segment? void fun(int n, int arr[]) { int *p=0; int i=0; while(i++<n) p = &arr[i]; *p = 0; }

1 Answers  


Categories