How to write in sublime text?

Asked

Viewed 317 times

0

I downloaded the sublime text, and set it to program in c, but the scanf doesn’t work, it shows the variable value, I can’t type.

#include <stdio.h>

void main() 
{
    int x; scanf("%d", &x);
    printf("%d", x);
}

I can’t type.

2147323904[Finished in 1.1s with exit code 10]
  • 1

    Put your code in C. That’s not Sublime’s problem.

  • To understand where the problem really occurs: http://answall.com/a/101703/101. This code has no problem.

  • Exclude my question.

  • Try to use int instead of void when calling the global function main()

2 answers

0

Try placing at the end of the code the following expression:

scanf("%d", &x);

The code would look like this:

#include <stdio.h>

void main() 
{
    int x;
    scanf("%d", &x);
    printf("%d", x);
    scanf("%d", &x);
}

It may be that the program, no longer having any operation to do, automatically closes.

0

The main() function may not accept the void as return. You can try the following:

#include <stdio.h>

int main() 
{
    int x;
    scanf("%d", &x);
    printf("%d", x);
    return 0
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.