I get this error whenever i run the program \" Assignment makes pointer from Integer without a cast\". My code is written below.... Please help... Thankx
struct
I think yourchar *number[3];
should be char number[3];
, or at least you should allocate space for each of the 3 number
pointers.
You haven't (at least, not in the pasted code) #include
d the header that defines the strtok
function. In C, functions that haven't been prototyped yet are assumed to return int
. Thus, we're assigning from an int
(function result) to a char*
(the type of token
) without a cast.
We don't want a cast, of course. We want to #include
the header, so that the compiler understands what strtok
returns.
But we also don't really want to use strtok
if there's anything else that will do the job. It has numerous limitations that aren't obvious. For robust string parsing, try sscanf
.