Im currently learning c, and I downloaded all necessary files for c to work on Vscode, if i run a code that doesnt have scanf, it runs normally, however, when I run a code that has scanf in it, it simply says "Running"
These are the extentions I downloaded
This is the code:
#include <stdio.h> int main() { int num; printf("Insert number"); scanf("%d", &num); printf("%d",num); return 0; } When i compile and run, it says this:
[Running] cd "c:\Users\LENOVO\Desktop\Programação\C" && gcc Exemplo.c -o Exemplo && "c:\Users\LENOVO\Desktop\Programação\C"Exemplo
but nothing happens. Can someone help me?
\nto your printfs, or flush or disable the buffer.scanffor the case that no number could be scanned at all (-> invalid input) – though this doesn't catch all possible input errors. I'd rather fetch entire input lines (fgets) and applysscanfto the buffer read. Makes overall input handling (including error handling!) simpler.