Or login with:
c (converted to a char) in the string s. If c is \0, strrchr locates the terminating \0.
#include <stdio.h> #include <string.h> int main() { char s[20] = "01234560789"; printf("The last position of '0' is %d.\n", strrchr(s, '0') - s); return 0; }
The last position of '0' is 7.
You must login to leave a messge