+ 1
What's a difference between putchar() & getchar () ? And give me one example of this .
3 Answers
0
Getchar takes a character input while putchar print a character output
Here an example:
#include <stdio.h>
#include <ctype.h>
int main()
{
  char c;
  printf("Enter some character. Enter $ to exit...\n");
  while (c != '#x27;)
  {
      c = getchar();
      putchar(c);
      printf("\n");
  }
  return 0;
}
If you input: HELLO$
The output will be:
H
E
L
L
O
+ 2
Ipang no thank you đ
Anyway I just copied and pasted from the first Google result for "getchar putchar"
Here's the link, maybe can help https://fresh2refresh.com/c-programming/c-file-handling/putchar-getchar-function-c/
+ 2
I understand. đ