main()

{

struct student

{

char name[30];

struct date dob;

}stud;

struct date

{

int day,month,year;

};

scanf("%s%d%d%d", stud.rollno, &student.dob.day,
&student.dob.month, &student.dob.year);

}



main() { struct student { char name[30]; struct date d..

Answer / susie

Answer :

Compiler Error: Undefined structure date

Explanation:

Inside the struct definition of ‘student’ the member of type
struct date is given. The compiler doesn’t have the
definition of date structure (forward reference is not
allowed in C in this case) so it issues an error.

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More C Code Interview Questions

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

2 Answers  


Write a function to find the depth of a binary tree.

13 Answers   Adobe, Amazon, EFI, Imagination Technologies,


main( ) { void *vp; char ch = ‘g’, *cp = “goofy”; int j = 20; vp = &ch; printf(“%c”, *(char *)vp); vp = &j; printf(“%d”,*(int *)vp); vp = cp; printf(“%s”,(char *)vp + 3); }

1 Answers  


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  


write a c program to Reverse a given string using string function and also without string function

1 Answers  






main() { struct student { char name[30]; struct date dob; }stud; struct date { int day,month,year; }; scanf("%s%d%d%d", stud.rollno, &student.dob.day, &student.dob.month, &student.dob.year); }

1 Answers  


All the combinations of prime numbers whose sum gives 32

1 Answers   HHH,


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  


Write a C program to add two numbers before the main function is called.

11 Answers   Infotech, TC,


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  


what is the output of following program ? void main() { int i=5; printf("%d %d %d %d %d ",i++,i--,++i,--i,i); }

10 Answers  


Write a program using one dimensional array to assign values and then display it on the screen. Use the formula a[i]=i*10 to assign value to an element.

1 Answers   Samar State University,


Categories