Ascii Conversion Program; printing error
I have been working on this program in C, and I don't understand why it is
printing beyond the range that parameters state. here is the program, can
anyone help me? Also, how do i get the input to reject numbers that arent
in specified range? Thanks in advance!
#include <stdlib.h>
#include <stdio.h>
#define LEN 64
int main(){
char line[LEN];
printf("Enter a #, 32-127: ");
fgets(line,LEN,stdin);
int i = atoi(line);
printf("Enter a #, %d-127: ",i);
fgets(line,LEN,stdin);
int j = atoi(line);
for(i;j;i++)
printf("ASCII value of character %d: %c\n",i,i);
return(EXIT_SUCCESS);
}
No comments:
Post a Comment