Start C language learning under Linux

Source: Internet
Author: User
Tags greatest common divisor

Why do you want to learn C language under Linux?

    1. Linux can experience the purest C language programming, can throw other IDE's influence
    2. Environment configuration is simple, one command is sufficient. Even for most Linux distributions, there is no need to configure the C language environment
    3. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.