Why do you want to learn C language under Linux?
- Linux can experience the purest C language programming, can throw other IDE's influence
- Environment configuration is simple, one command is sufficient. Even for most Linux distributions, there is no need to configure the C language environment
- Check the manual handy, under Linux if you don't know the use of a library function, direct man, also exercise English. If you want to know about man, then you must be man.
Ok,let ' s star!
First, open terminal, first enter VI hello.c create a new C source file
Then we went into the Vim editor and wrote a HelloWorld code.
Input: Wq Save
Then we can compile the program and enter GCC Hello.c-o Hello, which means to compile the previously written hello.c into a program called Hello.
Then we run the program called Hello and see if the screen is "Hello world!." ”?
What if we encounter a compile error? Or the previous HelloWorld code, let's try to get rid of a semicolon.
Results The compiler successfully prompts us where we went wrong.
OK, let's try a slightly more complicated program:
This is the code for the two-digit greatest common divisor, and then we compile && run
See how it turns out.
OK, here we have been able to successfully start the C language programming on Linux
Start C language learning under Linux