Compile the code below without error. When I enter the word (or phrase), printf
returns a random character like 0
�
a
etc. The program should read a word (or phrase) and printf show the word (or phrase) that was written by the user.
Use gcc as a compiler. I am compiling for the terminal at the moment. The distro that I'm using is Manjaro 17.0.5 (I do not know if it interferes with anything).
#include <stdio.h>
int main (void){
char example[20];
scanf("%*c", &example);
printf("example: %c\n", example);
return 0;
}