I am trying to finish this project and my decrypt does not work.
Key should be an array and should be updated at each character.

Code:
#include <stdio.h>
#include<string.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) {
		if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) {
			putc(easyendecrypt(c), stdout);
			key = c;
		}
		else {
			scanf("%*s %d", &c);	
			printf("Error", stderr);
		}
	}
	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
}