I'm using various standard string.h functions in a program that I am writing although I am obviously using them incorrectly. Although the program seems to work with these compiler errors (so far) I know that they indicate something is wrong and that the results expected to be returned may be undefined in some cases. I will try to show the appropriate lines of code in here so that you can see. The code as a whole is fairly long, so I will spare you all and just post little bits.
Code:
/* these are globals at the moment */
struct product
{
float price;
char *descript[80];
int quantity;
char *sku[5];
}
items[MAX_ITEMS];
*/ snip /*
/* here I simply try to compare the contents of a char string
and a string literal? I store the result in the int j so that I can test the results
of the compare /*
int j;
j = strcmp(items[num_lines].sku, "q");
/* same type of deal here except with a strcopy. I am trying to copy the contents of
the string desc, into the descript string (part of the product structure */
char desc[100];
strcpy (items[num_lines].descript, desc);
/* one final example. I open a file and try to write the contents of the product structure
to it, one attribute per line. Below I attempt
to write a char string to the file. */
FILE *fp;
fputs(items[counter].sku, fp);
The warnings I get are like this... I'll post the three separate warnings that I get from the lines above. I get many more similar warnings than the ones above, but I think that if I can get some guidance on these, then I should be able to figure the rest out for myself.
Code:
register3.c: In function `main':
register3.c:82: warning: passing arg 1 of `strcmp' from incompatible pointer type
register3.c: In function `display_item':
register3.c:225: warning: passing arg 1 of `strcpy' from incompatible pointer type
register3.c:308: warning: passing arg 1 of `fputs' from incompatible pointer type
Thanks guys, I apologize if this crap is difficult to read. If more info is required, I will happily provide.
Cheers
Arker.