[Linux] C language and Helloworld and helloworldc language are written in Ubuntu12.04.

Source: Internet
Author: User

[Linux] C language and Helloworld and helloworldc language are written in Ubuntu12.04.

Ubuntu12.04 comes with a C environment, which is much better than a C environment developed by Windows. This C is the C language that everyone wants to learn.

Especially in the C language of the year, the next VC6 egg hurts, and then kakaka, the error is prompted in English, it is very uncomfortable.

The process for writing C in Ubuntu is as follows.

1. Press Ctrl + Alt + R to open the terminal and enter:

gedit helloworld.c
Create a. c file.


2. Open a notepad page for you to write. Like a NotePad, keyword highlighting is much better than VC6's interface, and there is no Visual Studio card.


Enter Helloworld in the following C language. Don't talk about this Helloworld ...... It is said that members of the liberal arts computer group understand.

#include<stdio.h>void main(){printf("hello world\n");}

Let's put it in one sentence. I am in a good mood today. Don't discuss the problems between the main function int main () and void main () with me. OK?

3. Save and exit, and return to the terminal to continue the input. The output of Helloworld is displayed.

gcc helloworld.c -o helloworld./helloworld
As shown in:


The first sentence above is to compile helloworld. c into a helloworld executable program in Linux.

The second sentence is to run the executable file helloworld.

4. Now I have written the helloworld program. It is said that American computer colleges and universities must specify to write C in this way, and VC6 will be despised.

In fact, your helloworld. c and helloworld executable programs are in your main folder, that is,/pc/home/, where pc is the user name.


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.