hello, I'm trying to put in my code to check if non ASCII character is a valid input if not get an error message.
Code:
#include <stdio.h>
#include<string.h>
#include<stdlib.h>
#include<ctype.h>
#include<math.h>
int key= 65;
unsigned int easyendecrypt(char c);
int main(void) {
int c;
while ((c = getc(stdin)) !=EOF) {
putc(easyendecrypt(c), stdout);
}
key = 'A';
printf("\n");
return 0;
}
unsigned int easyendecrypt(char c) {
unsigned int k;
#ifdef DECRYPT
fprintf(stderr, "decrypting with %c\n",key);
k = c - key;
key = k;
return k;
#else
fprintf(stderr,"encrypting with %c\n",key);
k = c + key;
key = c;
return k;
#endif
}