Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using scanf in VS Code with the Code Runner extension

I tried a very simple code of C language using scanf, and it falls into the infinite loop(or it looks like). the code is the following:

#include <stdio.h>

int main(){
    int input = 0;
    scanf("%d", &input);
    return 0;
}

I used the code runner extension. Here is the screenshot just in case. enter image description here

Does anyone know how to fix it?

like image 962
Sunwoo Jeong Avatar asked May 14 '26 22:05

Sunwoo Jeong


1 Answers

I just came across the same problem. In my case, just search "code-runner.run" in the setting and check the box as follow.

Code-runner: Run In Terminal
[] whether to run code in integrated terminal.

Image instruction: screenshot

like image 103
Rex Wang Avatar answered May 16 '26 11:05

Rex Wang



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!