#include #include #include int main() { char *digits="0123456789"; char x[] = "2abc"; int result = atoi(x); printf ("case a) string %s is %d as decimal\n",x,result); if (strlen(x) == 0 || (strspn(x,digits) != strlen(x))) printf ("case b) %s is NOT a simple positive integer!\n" " there are either no digits or non-digits\n", x); char y[] = ""; int result_y = atoi(y); printf ("case c) a null string results in %d\n",result_y); return 0; } /* prints: case a) string 2abc is 2 as decimal case b) 2abc is NOT a simple positive integer! there are either no digits or non-digits case c) a null string results in 0 */