I am having trouble converting chars into ints:
Code:
char input[100];
int in, count, i;
while ((in = fgets(fp) != EOF){
input[count] = in;
++count;
}
int sum;
for(i=0,i < count; ++i){
if (isdigit(input[i])){
printf("%c", input[i]); // this is ok, prints the actual number, if actual num is 1 then 1 is printed
printf("%d", input[i]); // not ok, if actual num is 1, 49 is printed
sum = 1 + input[i] // if actual num is 1, sum should be 2
// but it is 50
printf("sum %d", sum);
}
}
What is the proper way of doing this ?