getchar is a character function but gets is a string function. The header file cstdio must be included. It reads a character from the keyboard.
Eg.
char ch;
ch=getchar();
cout<<ch;
gets is used to read a string from the key board. It reads the characters upto enter key.
The header file
cstdio must be included.
char str[80];
cout<<” Enter a string”;
gets(str);