The input consists a string and an integer, which are separated by a '/', like this:
hello/17
And I want to read the input into a string and an int, like this:
char str[20];
int num;
scanf("%s/%d", str, &num); // this how I tried to do it.
I can’t seem to make it, any advice?
scanfawaits a whitespace terminated string when it tries to read%s.Try to specify the forbidden character set directly:
You can read more about the formating codes here