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.
2 Answers
- CTRL+SHIFT+X
- Type in search box Code Runner
- Install the extension
- Than click on File - Preferences - Settings
- Type code run in search box.
- Scroll down until you find Code-runner: Run In Terminal. Check the box Wheather to run code in Integrated Terminal.
- Restart VS Code
Good luck!
1first 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