main()
{
char string[]="Hello World";
display(string);
}
void display(char *string)
{
printf("%s",string);
}
Answers were Sorted based on User's Feedback
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 |
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 |
main() { char *p = “ayqm”; char c; c = ++*p++; printf(“%c”,c); }
Write a routine to draw a circle (x ** 2 + y ** 2 = r ** 2) without making use of any floating point computations at all.
2 Answers Mentor Graphics, Microsoft,
main() { int x=5; for(;x!=0;x--) { printf("x=%d\n", x--); } } a. 5, 4, 3, 2,1 b. 4, 3, 2, 1, 0 c. 5, 3, 1 d. none of the above
How to count a sum, when the numbers are read from stdin and stored into a structure?
Link list in reverse order.
void main() { if(~0 == (unsigned int)-1) printf(“You can answer this if you know how values are represented in memory”); }
main() { int i=3; switch(i) { default:printf("zero"); case 1: printf("one"); break; case 2:printf("two"); break; case 3: printf("three"); break; } }
main() { int c = 5; printf("%d", main||c); } a. 1 b. 5 c. 0 d. none of the above
writte a c-programm to display smill paces
main() { int i=5; printf("%d",++i++); }
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++; } }
write a c program to Create a mail account by taking the username, password, confirm password, secret_question, secret_answer and phone number. Allow users to register, login and reset password(based on secret question). Display the user accounts and their details .