figure out if C string contains int or char?


basically, I need to know if a C string contains numbers or words for error checking.

I am very sticky when it comes to char arrays & strings...
what would you do for:
1) char*p
2) char p[]
3) char p[][]
4) char** p

Sorry if I seem confused on arrays & strings as well!

C-string or null-terminated string is an array of char, which ends with '\0'
I personally prefer char p[] to indicate that it is an array of char, not the pointer to single char.

For your question, most productive way will be to look if your string contains only numbers (and possibly '-' as first character)
Topic archived. No new replies allowed.