if i do this, the character replacement works: it will replace everything with *'s
#include <stdio.h>#include <stdlib.h>#include <ctype.h>char encode(char ch);int main(){ char ch; while (ch = getchar() != EOF) { ch = encode(ch); putchar(ch); } system("pause"); return 0;}char encode(char ch){ ch = '*'; return ch;}
however if i surround the "ch = '*'; part with a check to only do it if it is a alphabetic character it does not work outputs just some funky smiley face character.
char encode(char ch){ if (isalpha(ch)) { ch = '*'; } return ch;}
also another question, how would i go about making the value of ch be the next letter from what ch currently is.