catalog

* Hello world! program
* Preprocessing command
* Header file
* Principal function
* Function return value
* notes
* Hello world! Enhanced Edition
<> One , The simplest C program Hello world!
#include<stdio.h> // Compile preprocessing command int main() // Defining the main function , The main function type is integer (int) { // Flag for the start of the function printf
("Hello world!"); // Output content return 0; // Returns an integer value when the function completes execution 0 } // Flag for the end of the function
Operation results :

<> Two , preprocessor directives (#include<stdio.h>)

1. Action bar stdio.h The contents of the header file are read in
2. Other preprocessing commands :#define

<> Three , Header file (stdio.h)

stdio.h There are inputs in the file (scanf), output (printf) Prototype declaration of equal function

* std Representation standard :standard
* i Represents input : input
* o Represents the output :output
* .h Represents the header file head ( File suffix )
<> Four , Principal function (main)

every last C All language programs must have one main, And the main function has and only has 1 individual .

<> Five , The return value of the function (return 0)

Principal function main The return value of is 0 Indicates that the program exits normally
When the return value is nonzero , Indicates that the program exited abnormally

<> Six , notes

C The language allows two annotations

The first one : with // Starting single line comment
The second kind : with /* start , with */ Closing multiline comment ( Block annotation )

<> Seven ,Hello world! Enhanced Edition

Enhanced Edition 1………………
#include<stdio.h> int main() { printf("\tHello world!\n"); // \n Line break \t Horizontal space
return 0; }
results of enforcement :

Enhanced Edition 2………………
#include<stdio.h> int main() { printf("\n\tHello\n\nworld!\n"); // \n Line break \t
Horizontal space return 0; }
results of enforcement :

Enhanced Edition 3…………… Welcome to C The world of language
#include<stdio.h> int main() { printf("\n\t***********************\n"); printf(
"\t* *\n"); printf("\t* Welcome to C The world of language *\n"); printf("\t* *\n"); printf(
"\t***********************\n"); return 0; }
results of enforcement :

adopt \n Line break ,\t The combination and design of some escape characters such as horizontal space , A program that allows you to write , The output content is more beautiful and attractive .
…………………………
That's what I've been doing over time C Language learning , The simplest summary C The function of various contents in the program and the enhanced version Hello world!
If there is anything wrong with the above , Please correct me ( Common progress )

This is the first one I wrote C program , I don't know if you are !!!

At that time , While writing this program , On the computer , Repeated revision , Finally, when output on the screen Hello world! When the heart suddenly exclaimed : From then on, it can be regarded as a program ape “ No return ”
……

Technology