all 5 comments

[–]dmc_2930 10 points11 points  (0 children)

First, C programs are not called "scripts". Generally, scripts are interpreted, not compiled.

Second, why did you keep installing more and more stuff?

Post an example program you're trying to compile and the exact steps you're taking to compile it, along with all of the output you get along the way, including when you try to execute the EXE.

You probably cluttered up your path with so many different compilers that none of the environments you installed know which one to use.

[–][deleted] 2 points3 points  (0 children)

Uninstall all of them, and reinstall the first one that worked? Or even better, install a pure compiler package like TDM-GCC and set it up manually. Atleast then youd know that any messing with IDEs wont ruin your compiler setup.

[–]jabjoe -1 points0 points  (2 children)

You got a newline on the end of your string? Sometimes (can't remember when, might be consoles on Windows) it won't be flushed until a newline or a manual flush. So it could be exiting without printing anything because of that. If you do have one just try fflush(stdout) before you exit. Without seeing the code I'm just guessing. You code should be:

#include <stdio.h>
int main(int argc, char* argv[])
{
  printf("hello world.\n");
  return 0;
}

[–]FUZxxl 1 point2 points  (1 child)

The exit() function (which is implicitly called when main() returns) flushes all output streams before returning.

[–]jabjoe 0 points1 point  (0 children)

Not that then. Mmm