I'm writing a practice program to read in two characters (the first character coming first alphabetically) and then print out the letters between the two entered( including the inputs) in alphabetical order. what my problem is... well i dont really know what i am doing wrong but im getting crazy outputs. but im not using the ascii numbers for the letters just A=0, B=1, C=2, etc. can anyone help me with this issue? thanks.
Code:
#include <stdio.h>
#include <stdlib.h>
char startchar;
char endchar;
int i = 0;
char s;
char e;
void charbtwn(char s, char e);
int main(void) {
scanf("%c %c", &startchar, &endchar);
charbtwn(startchar,endchar);
system("pause");
return(0);
}
void charbtwn(char s, char e) {
for(i=s; i<=e; i++) {
putchar('A' + i);
}
}