Start C language learning and LinuxC language learning in Linux

Source: Internet
Author: User

Start C language learning and LinuxC language learning in Linux

Why C language learning in linux?

 

OK, let's star!

 

Step 1: open terminal and input vi hello. c to create a c source file.

 

Then we enter the VIM editor and write a helloworld code.

 

Input: wq save

 

Then we can compile the program and input gcc hello. c-o hello, which means to compile the previously written hello. c program named hello.

 

Then we run the program named hello to see if "hello world!" is displayed on the screen !"?

 

What if we encounter a compilation error? Or the previous helloworld code. Let's try to get the result of removing a semicolon.

 

As a result, the compiler successfully prompts us where an error occurred.

 

OK. Next, let's try a slightly more complex program:

 

This is the code for finding the maximum common divisor of two numbers. Next we compile and run

 

See how it works.

 

OK. Now, we can successfully start C Programming on linux.

Related Article

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.