Sunday 15 February 2015

c - How to find the indices at which strtok() splits the string? -


I was using the strtok () function in C. It gives the pointer on those places where this string splits.

  int main () {char s [100] = "ABCD"; Four * p; P = stroke (S, ""); While (p! = Null) {p = stroke (null, "."); // do something} return 0; }   

How can I get an index that is divided (preferably continuous time)?

To find the pointer:

  ptrdiff_t index = p - S;   

On one side: Show your actual code - s = "A B C D" will not be compiled.

No comments:

Post a Comment