-
Pointer / Integer error
Hi,
I am trying to get my head around a warning, I have searched about but found no examples that are similar to my case.
The warning I get on compiling is;
assignment makes pointer from integer without a cast
Code:
int len;
char temp[15];
char *ptr;
get string off user
strcpy(pass,ptr); <-- this is the line generating the warning
I assume I have done something silly somewhere here?
-
what is the type of pass?
-
oh sorry, pass should be temp. I have been cutting and pasting around to try and figure out what the error was complaining about.
Code:
int len;
char temp[15];
char *ptr;
get string off user
strcpy(temp,ptr); <-- this is the line generating the warning
-
how are you 'getting the string' from the user?
-
That shouldn't be the line causing the problem you reported. Something is being assigned to ptr improperly before that... probably in that "get string off user" part that you skipped over. We need to see that bit of code.
-
It seems like "ptr" is not assigned properly. Please check its assignment.
-
Just to make sure... did you include string.h?