#include int main(void) { char ip[15] = {"192.168.100.100"}; int retval, val0, val1, val2, val3; if(4!=(retval=sscanf(ip, "%d.%d.%d.%d", &val0, &val1, &val2, &val3))) { printf("Error: sscanf failed, retval was: %d\n", retval); } else { printf("%d\n%d\n%d\n%d\n", val0, val1, val2, val3); } return 0; }