main()

{

show();

}

void show()

{

printf("I'm the greatest");

}

Answers were Sorted based on User's Feedback



main() { show(); } void show() { printf(&quo..

Answer / susie

Answer :

Compier error: Type mismatch in redeclaration of show.

Explanation:

When the compiler sees the function show it doesn't know
anything about it. So the default return type (ie, int) is
assumed. But when compiler sees the actual definition of
show mismatch occurs since it is declared as void. Hence the
error.

The solutions are as follows:

1. declare void show() in main() .

2. define show() before main().

3. declare extern void show() before the use of show().

Is This Answer Correct ?    7 Yes 0 No

main() { show(); } void show() { printf(&quo..

Answer / ravneet kaur

ans: declaration terminated incorrectly.

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More C Code Interview Questions

Predict the Output: int main() { int *p=(int *)2000; scanf("%d",2000); printf("%d",*p); return 0; } if input is 20 ,what will be print

2 Answers  


main() { main(); }

1 Answers  


func(a,b) int a,b; { return( a= (a==b) ); } main() { int process(),func(); printf("The value of process is %d !\n ",process(func,3,6)); } process(pf,val1,val2) int (*pf) (); int val1,val2; { return((*pf) (val1,val2)); }

1 Answers   Satyam,


#include<stdio.h> main() { register i=5; char j[]= "hello"; printf("%s %d",j,i); }

2 Answers  


void main() { char a[]="12345\0"; int i=strlen(a); printf("here in 3 %d\n",++i); }

3 Answers  






&#8206;#define good bad main() { int good=1; int bad=0; printf ("good is:%d",good); }

2 Answers  


#include <stdio.h> #define a 10 main() { #define a 50 printf("%d",a); }

2 Answers  


int a=1; printf("%d %d %d",a++,a++,a); need o/p in 'c' and what explanation too

1 Answers  


main( ) { int a[ ] = {10,20,30,40,50},j,*p; for(j=0; j<5; j++) { printf(“%d” ,*a); a++; } p = a; for(j=0; j<5; j++) { printf(“%d ” ,*p); p++; } }

1 Answers  


main() { int i=400,j=300; printf("%d..%d"); }

3 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  


int i=10; main() { extern int i; { int i=20; { const volatile unsigned i=30; printf("%d",i); } printf("%d",i); } printf("%d",i); }

1 Answers  


Categories