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

How do I write a program to print proper subset of given string . Eg :input: abc output:{},{a},{b},{c},{a,b},{a,c},{b,c}, {a,b,c}.I desperately need this program please mail me to saravana6m@gmail.com

11 Answers   Deshaw, Infosys,


int main() { int x=10; printf("x=%d, count of earlier print=%d", x,printf("x=%d, y=%d",x,--x)); getch(); } ================================================== returns error>> ld returned 1 exit status =================================================== Does it have something to do with printf() inside another printf().

2 Answers  


main() { { unsigned int bit=256; printf("%d", bit); } { unsigned int bit=512; printf("%d", bit); } } a. 256, 256 b. 512, 512 c. 256, 512 d. Compile error

1 Answers   HCL,


char *someFun1() { char temp[ ] = “string"; return temp; } char *someFun2() { char temp[ ] = {‘s’, ‘t’,’r’,’i’,’n’,’g’}; return temp; } int main() { puts(someFun1()); puts(someFun2()); }

2 Answers  


main() { int y; scanf("%d",&y); // input given is 2000 if( (y%4==0 && y%100 != 0) || y%100 == 0 ) printf("%d is a leap year"); else printf("%d is not a leap year"); }

1 Answers  






find A^B using Recursive function

2 Answers  


What is your nationality?

1 Answers   GoDB Tech,


Is it possible to type a name in command line without ant quotes?

1 Answers   Excel, Infosys,


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

1 Answers  


Is there any difference between the two declarations, 1. int foo(int *arr[]) and 2. int foo(int *arr[2])

1 Answers  


How do you verify if the two sentences/phrases input is an anagram using predefined functions in string.h and by using arrays?

0 Answers  


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

7 Answers  


Categories