Good day to you guys! im having a bit of a problem using strtok. im currently tinkering with extracting gps data, which are separated by commas. ive seen code in several forums but most of them assign the output of strtok to the same char pointer.
what i want to do is assign the tokens to different char pointers. the relevant part of the code is shown below. what happens is that once i try to assign the next token to char pointer ns, i get an invalid conversion from char to char* error. i dont know why this happens. any help is appreciated.

char gps[] = "$GPGGA,002153.000,3342.6618,N,11751.3858,W,1,10,1.2,27.0,M,-34.2,M,,0000*5E";
char* take_tok;
char* latitude,longitude, ns;

  take_tok = strtok (gps , ",");
  take_tok = strtok (NULL , ",");
  latitude = strtok (NULL , ",");
  ns = strtok (NULL , ",");

the problem occurs at line 8

Yes, you can assign different pointer, however you are not doing so.

char* latitude,longitude, ns;

That expands to

char *latitude;
char longitude;
char ns;

Do you see the problem? Only the first declaration is a pointer, the rest are just regular chars.

This question has already been answered. Start a new discussion instead.