0

i'm trying to parse a string of digits that can be 1 to 3 chars long, but how to do this is eluding me.

would an isDigit method work? like this:

if(isdigit(vararray[v])){
			if(isdigit(vararray[v+1]) || vararray[v+1]==NULL){
				if(isdigit(vararray[v+2]) || vararray[v+2]==NULL){
					if(isdigit(vararray[v+3]) || vararray[v+3]==NULL){
						return;
					}
					return;
				}
				return;
			}
			return;
		}

but i get the warning: comparison between pointer and integer.

am i close to a solution for this problem?

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by Salem
0

> vararray[v+1]==NULL
Well if vararray is an array of char, then testing the nul character (as opposed to the NULL pointer) is what you should be doing.

As in vararray[v+1]=='\0'

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.