0

I get this warning while compiling my c-code (in c89/90), and I´m lost how to fix that. can anybody help?

edge_target is a pointer, and strsep returns a pointer, it should be all ok, or am I missing something?

warning: assignment makes pointer from integer without a cast [enabled by default]

char* edge_target;
while ((edge_target = strsep(&splitme, " ") ) != NULL)
jacksbox
  • 911
  • 1
  • 11
  • 24
  • 1
    `#include ` BTW: what is `splitme` ? – wildplasser Jun 04 '16 at 12:41
  • 3
    Please post a [Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve). `strsep` isn't a standard funtion. Are you sure your compiler supports it, and that proper header is included, and that proper macro is defined before including the header to enable the function if it is required? – MikeCAT Jun 04 '16 at 12:41
  • string.h is included... but the "is not a standard function" hint helps me already – jacksbox Jun 04 '16 at 12:45
  • 1
    [strsep.c](https://fossies.org/dox/gnupg-1.4.20/strsep_8c_source.html) – BLUEPIXY Jun 04 '16 at 13:04
  • Though non-standard, `strsep` is part of GNU C and BSD C libraries. In `man` pages there's examples for proper usage. – user3078414 Jun 04 '16 at 13:07
  • This example couldn't reproduce your problem: `#include #include #include int main (void) { char *edge_target, *splitme; splitme = strdup("split me now"); assert(split_me != NULL); while ((edge_target = strsep(&splitme, " ")) != NULL) printf("%s\n", edge_target); return 0; }` . Compiled: `c89 -o sep sep.c`. So it's likely elsewhere. How do you declare and initialize `splitme` ? – user3078414 Jun 04 '16 at 13:45

0 Answers0