Friday, July 31, 2009

Question on c I am using linux/unix to write my code?

This is an external function from a big program i am doing a stub test because if i run the whole program the questions overload and i cannot input data the only variable that i can input is the lastname. This is what the warning say employedata.c:7: warning: incompatible implicit declaration of built-in function


employedata.c:8: warning: incompatible implicit declaration of built-in function


#include %26lt;string.h%26gt;


#define MAX 5


void employedata(char lastname[30+1],char firstname[30+1],


float *hours,float *payrate,float *ssidefr)


{


int i = 0;


printf("Enter employee last name ");


scanf("%s", lastname[i]);


printf("Enter employee first name ");


scanf("%s", firstname[i]);


printf("Input employee hours ");


scanf("%f", hours[i]);


printf("Input employee payrate ");


scanf("%f", payrate[i]);


printf("Input deferred earnings ");


scanf("%f", ssidefr[i]);


}

Question on c I am using linux/unix to write my code?
It can't find the printf function. Add:





#include %26lt;stdio.h%26gt;
Reply:What exactly is the question ?





If you are wondering why you are getting warnings, add this in the beginning:





#include %26lt;stdio.h%26gt;
Reply:i think scanf expects a pointer, but you give him a char.





try this:


scanf("%s", %26amp;lastname[i]);


scanf("%s", %26amp;firstname[i]);

paid survey

No comments:

Post a Comment