Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with my function and !isalnum

Status
Not open for further replies.

DougP

MIS
Dec 13, 1999
5,985
US
I want to check for valid characters numbers and letters
so I created a function called is_separator.
but when I call it, it gives and 2 errors and 1 warning
Line numbers are shown in code below as comments

Error Line 55, conflicting types for is_separator.

then a warning below that error:
warning Line 55, Note: an argument type that has a default promotion can't match an empty parameter name list declaration.

then another error line 24
Error Line 24: previous implicit declaration of 'is_separator' was here

Code:
void word_reverse( char* str ){
         
      int a;
      char m;
      int isvalidchar;
      printf("sizeof %d\n",strlen(str));*/
      
      /* check each character one at a time */
      	for (a = strlen(str) ; a >= 0 ; a-- ){
      		m=str[a];
      		isvalidchar=is_separator(m); [COLOR=red]/* line 24*/[/color]
			if (isvalidchar=0){
				/* character is not a alpha or number */
				printf("Is NOT a valid character%c");
			}
			else{
				/* character is an alpha or number */
				printf("IS a valid character%c");
			}
		
		
		printf("m=%c\n", m);
		}  


}


int is_separator( char data ){ [COLOR=red]/* line 55 */[/color]

    
    return ( !isalnum(data) ); 
     
}

DougP
[r2d2] < I Built one
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top