0
#include <cs50.h>
#include <stdio.h>

int main(void) {
    string answer = get_string("what is your name? ");

    printf("%s\n", answer);
}

I have a program with this code, that is running well, every other program that asks for input does not run rightly. I am on windows 10, I used MINGW to compile the program.

genpfault
  • 51,148
  • 11
  • 85
  • 139
  • 1
    Please [don't show images of text](https://meta.stackoverflow.com/questions/285551/why-should-i-not-upload-images-of-code-data-errors-when-asking-a-question). [Edit] your question to copy-paste your code and the output/input text, *as text*, into your question. – Some programmer dude Oct 19 '22 at 12:26
  • 1
    The program is fine. Try to run it directly from the command prompt instead of from inside Visual Studio Code. – Ted Lyngmo Oct 19 '22 at 12:38

1 Answers1

-1
    You could try it this way

#include<string.h> #include <stdio.h>

 int main(void) {
char answer[20];
printf("What is your name"); 
 gets(name);

printf("%s\n",  answer);

}

  • 2
    [`gets` is so dangerous](https://stackoverflow.com/questions/1694036/why-is-the-gets-function-so-dangerous-that-it-should-not-be-used) that it was removed in the C11 standard. Never ever user it, and never ever recommend it. – Some programmer dude Oct 20 '22 at 08:01
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Oct 21 '22 at 16:59