C Language Course 1--hello world

Source: Internet
Author: User

I believe you have read the first article, are full of confidence, behind me to point to the actual bar, on the code, classic: Hello world.

First of all, do not know what tools you use, VC6.0 (too old, strongly recommend not), VS, or other ~

The code for Hello World is simple, so long

1 #include <stdio.h> 2 void main (void) 3 {4      printf ("Hello world!" ); 5}  

is not very simple, let me briefly say.

Line 1th #include <stdio.h>, is the compile preprocessing command, "include" is the meaning of "include", do everything to have a basis, the same code needs to have a foundation, the basis is already written, we just need to use, This requires us to "include" them in, this sentence contains "stdio.h", that is, "standard input/ouput", standards of input and output.  Then look at the 4th sentence printf ("Hello world!"); , "printf" is the meaning of printing, that is the output, we use "printf", we need to include "stdio.h" the basis, ". h" is "header file"!

Line 2--5 is a function, and main is the function name of the main function, and any project must have a main function, 3--5 the function body of main function main (). Void is the meaning of "null", the first void is the return type of main function main (), here is empty, is not returned. The second void is the "formal parameter" of the main function and is empty, and this "void" can be omitted.

The four innings printf ("Hello world!"); is to print "Hello world!".

Above said these must understand ha, do not understand the words to see again!!!

1 #include <stdio.h>           //contains stdio.h header file 2 void main (void)                //parameter is empty, return null for main function 3 {4      printf ("Hello world!"); Print Hello world! 5}

Here you need to understand a few nouns "header file", "main function", function body, "formal parameter", "return type", do not understand the definition, you can go to see what the book said Ha.

Similarly, if you use other functions, and "stdio.h" is not included, then we need to write a #include to include it. If the main function return is not NULL, then the function body must return a corresponding value, such as

1 #include <stdio.h> 2 int main (void) 3 {4      printf ("Hello world!" ); 5       return 0; 6}   

There may be some place in the process that is wrong, and we hope that we learn together.

C Language Course 1--hello world

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.