Error: Assignment makes pointer from Integer without a cast… in C Prog

巧了我就是萌 提交于 2019-12-02 11:29:19

You haven't (at least, not in the pasted code) #included 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.

I think yourchar *number[3]; should be char number[3];, or at least you should allocate space for each of the 3 number pointers.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!