+ 1
Can anyone explain how strchr works in C?
https://code.sololearn.com/cNXYjgRSaRBs/?ref=app Why do we put b-a+1 to print the current position of char in the string? Please explain the logic
2 Respuestas
+ 2
NotAPythonNinja oh now I get it, thanks!
+ 1
NotAPythonNinja thanks for answering but I'm not able to get why b-a will give me the index of the char?
I get it, b returns the pointer to the char, and a stores the given string, but how does b-a exactly give me the index, can you please explain this.