-----------------------------------------------------------------------------------------
1. Before writing the C language on Mac and Linux, first look to see if the compiler is installed:
Enter GCC under the terminal to check the carriage return, if installed, will prompt Clang:error:no input files (no input file);
If it is not installed, install the Xcode or GCC compiler under the prompts under the Mac, and directly yum-y the install GCC gcc-c++ under CentOS (-y means you will be selected automatically)
[email protected] Black eyed poet <www.chenwei.ws>----------------------------
2. Now start writing the code happily:
Use Command+r on your new project file in Xcode to compile and run your C code directly.
Under the Mac terminal, using the artifact vim, such as Vim test.c, it will not help you create a new test.c, after writing the C code you need to Command+s save, and then: wq! exit, use the command gcc TEST.c compile, do not specify the compiled file name, the compilation file name will be a.out, run it to use./a.out
Under Linux, also use vim, input vim test.c when the new test.c file in the current directory, write the C code directly: wq! save exit, use GCC test.c compile, run the compiled file./a.out
Sublime text is a worthwhile text editor, if you install the environment, use CMD+B to compile the code, shift+cmd+b run, but Sublime can only run a program, if you need to run an input program, you must leave Sublime to enter the terminal.
In the Windows environment, the C + + integrated development Environment (IDE) recommends dev-c++, which is not covered here: Http://sourceforge.net/projects/orwelldevcpp/?source=directory.
3. DEMO:
" stdio.h " int Main () { printf ("nihao,shijie! \ n"); Nihao, Shijie
printf ("12+12=%d", 12+12); 12+12=24
return 0 ; }
[c] compiling the execution program at the command line