Monday, 9 September 2013

%s expects type 'char *', but argument 2 has type 'int'

%s expects type 'char *', but argument 2 has type 'int'

I'm new to C so we had this assignment to make, and I tried to make it
more complex.
http://pastebin.com/A6z4MHGn
My current problem is making wordMin of type char* which I do not know why
it is not already.
I tried making a similar, but shorter program
int numHrs = 2;
char* hours;
if (numHrs == 1) {
hours = "hour";
} else {
hours = "hours";
}
printf("\n%s\n\n", hours);
And here it works just fine.
Any feedback on my pastebin code is very much appreciated as I am new to
coding and do not know the smartest way of doing things :-)
Regards, Lau

No comments:

Post a Comment