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 |
struct point { int x; int y; }; struct point origin,*pp; main() { pp=&origin; printf("origin is(%d%d)\n",(*pp).x,(*pp).y); printf("origin is (%d%d)\n",pp->x,pp->y); }
#include<stdio.h> #include<conio.h> void main() { int a=(1,2,3,(1,2,3,4); switch(a) { printf("ans:"); case 1: printf("1");break; case 2: printf("2");break; case 3: printf("1");break; case 4: printf("4");break; printf("end"); } getch(); }
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,
char inputString[100] = {0}; To get string input from the keyboard which one of the following is better? 1) gets(inputString) 2) fgets(inputString, sizeof(inputString), fp)
how can u draw a rectangle in C
53 Answers Accenture, CO, Codeblocks, Cognizant, HCL, Oracle, Punjab National Bank, SAP Labs, TCS, University, Wipro,
How to palindrom string in c language?
can you use proc sql to manpulate a data set or would u prefer to use proc report ? if so why ? make up an example and explain in detail
Under linux environment can u please provide a c code for computing sum of series 1-2+3-4+5......n terms and -1+2-3+4-5...n terms..
main() { int i=_l_abc(10); printf("%d\n",--i); } int _l_abc(int i) { return(i++); }
#include<stdio.h> main() { FILE *ptr; char i; ptr=fopen("zzz.c","r"); while((i=fgetch(ptr))!=EOF) printf("%c",i); }
code of a program in c language that ask a number and print its decremented and incremented number.. sample output: input number : 3 321123
main() { struct date; 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); }