can anyone tell me what's wrong with this. My compiler for some reason only tells me that I have a couple "invalid lvalue in assignment" and "conflicting types for int_check", but it will not give me the lines. Thanks
Code:
#include <stdio.h>
#include <ctype.h>
#include <string.h>
void int_check(char [], int *, int *);
int main() {
char strg[20];
int str_int=0,i,len,flag;
gets(strg);
int_check(strg,&str_int,&flag);
if(flag==-1)
printf("ERROR");
else
printf("%d\n",str_int);
}
void int_check(char strg, int *str_int, int *flag) {
int len,i;
len=strlen(strg);
for(i=0; i<len; i++) {
if(isdigit(strg[i]))
&flag=1;
else {
&flag=-1;
break;
}
if (*flag==-1)
break;
else
&str_int=atoi(strg);
}