In the piece of code given below. Whenever I am inputing a set of characters with a ctrl+z at the end, which should mark EOF for getchar(). It is printing all the characters along with another character at the end which has an ASCII value of 26. I dont know the character by name.
I expect the program to end wherever I put a ctrl+z. However Ctrl+z is only working when the input stream is empty.
Can someone explain why is it returning such an awkard character instead of ending the program ?
#include<stdio.h>
#include<ctype.h>
int main(){
int c;
while((c = getchar()) != EOF)
putchar(c);
return 0;
}
Sorry I couldn't upload the image, neither do I have any way of showing the character which has that value of 26. ASCII table charts say 26 is /substitute/. I don't know what that means. Thank You.