Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


main()

{

char string[]="Hello World";

display(string);

}

void display(char *string)

{

printf("%s",string);

}

Answers were Sorted based on User's Feedback



main() { char string[]="Hello World"; display(string); } ..

Answer / susie

Answer :

Compiler Error : Type mismatch in redeclaration of
function display

Explanation :

In third line, when the function display is
encountered, the compiler doesn't know anything about the
function display. It assumes the arguments and return types
to be integers, (which is the default type). When it sees
the actual function display, the arguments and type
contradicts with what it has assumed previously. Hence a
compile time error occurs.

Is This Answer Correct ?    21 Yes 3 No

main() { char string[]="Hello World"; display(string); } ..

Answer / pratibha

this problem of type mismatching can be solved by declaring display function as a first line inside main() so that compiler will know that display is of type void and then it will resolve type mismatch while encountering calling function of display.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Code Interview Questions

how can i cast a char type array to an int type array

2 Answers  


main() { register int a=2; printf("Address of a = %d",&a); printf("Value of a = %d",a); }

3 Answers  


To reverse an entire text file into another text file.... get d file names in cmd line

0 Answers   Subex,


main() { int i=5,j=6,z; printf("%d",i+++j); }

2 Answers  


#include<stdio.h> main() { int a[2][2][2] = { {10,2,3,4}, {5,6,7,8} }; int *p,*q; p=&a[2][2][2]; *q=***a; printf("%d..%d",*p,*q); }

1 Answers  


main() { extern out; printf("%d", out); } int out=100;

1 Answers  


Program to find the largest sum of contiguous integers in the array. O(n)

11 Answers  


What is the difference between proc means and proc tabulate ? explain with a simple example when you have to use means or tabulate?

1 Answers  


main() { char p[ ]="%d\n"; p[1] = 'c'; printf(p,65); }

2 Answers  


how can i search an element in an array

2 Answers   CTS, Microsoft, ViPrak,


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

1 Answers  


All the combinations of prime numbers whose sum gives 32

1 Answers   HHH,


Categories