Why VS Code doesn't want to run code when I use scanf() function to get user's input knowing that without this function the code runs perfectly.

enter image description here]

  • 1
    Look at the terminal tab
    – Daniel
    Aug 26, 2019 at 11:58
  • Programming questions are out of scope here at Super User
    – Ramhound
    Aug 26, 2019 at 11:58
  • It's not really a programming question. It's a "how to use the IDE" question Mar 3, 2020 at 7:32

2 Answers 2

  2. Type in search box Code Runner
  3. Install the extension
  4. Than click on File - Preferences - Settings
  5. Type code run in search box.
  6. Scroll down until you find Code-runner: Run In Terminal. Check the box Wheather to run code in Integrated Terminal.
  7. Restart VS Code

Good luck!

  • thanks! I installed the C extension and apparently it doesn't enough. So thank you for this
    – alramdein
    Apr 1, 2021 at 13:10

first of all I'm a begginer in VS code so I will try my best to explain how I sort of fixed this "error". Hope this post still helps a lot of people.

What I think is happening is that this C program gets only compiled when you hit "Run Code". I'm not sure about this at all. The solution I found is that the right way to actually run your program is by "Start Debugging" (F5). Now when you go to the .json file where the configuartion for debugging is located. You simply need to change the line "externalConsole" and set it to "true". And that's basically it. After that you simply Run your program with (F5). Keep in mind that if you change something in your original code you need to run it with "Run Code", (ctrl+alt+n) so that the uptades you do get saved and "compiled".

Hope I helped

Line to change: enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.