[Solved] strtok not working as expected

strtok is working exactly as expected. It breaks the input apart into the strings 123 and 456. strtok (tempRead, ” “); /* Returns 123 */ strtok (NULL, ” “); /* Returns 456 */ I think you can do with a simpler solution: int i = 0; char tempRead[30]; … while (tempRead[i] == ‘ ‘ && … Read more

[Solved] Parsing user input. C [closed]

you’ll be needing strncmp function with string.h header to compare (check) if the characters Palin( have been entered or use KMP/Needle In The Stack algo to match the strings. For taking out the content in the () from Palin() in an array say destination[]: #include<stdio.h> #include<string.h> #define MAX 100 int main() { char source[]=”palin(hello)”; int … Read more