※スタイルシート未対応ブラウザではレイアウトを正確に再現できません。
  > | advanced by | contents  | that returns in <    
                   < [modosusu] > Color magazine monochrome light and shade   font predetermined, Gothic Ming-style type longhand   size Konaka large   standard  


  Program that doesn't do anything   

  1. ..clause 1..: Structure of C language
  2. ..clause 2..: How to make function
  3. ..clause 3..: The main function specially :.
  4. ..clause 4..: Operate the program.

[1] Structure of C language

Hereafter, make the first program by C language.
However, making the program with various functions from the start : because it is impossible.
First of all, start from making the program that doesn't do anything in which the function is not provided either.

By the way, what knowledge is necessary to make the program of C language?
If it doesn't know the structure no matter what it makes it, it is not likely to be able to make it.
Even C language of this is similar though it is necessary to know the structure of the bookshelf to make the bookshelf.

Then, what on earth structure is the structure of C language?
Combine and make various parts when you make the machine.
Similarly, the programming combines parts. This part is called a function.
In a word, the program of C language gathers functions and is made.


[   C language program structure   ]
The program of C language gathers functions and is made.
Noting it here is a point of not the row of the function but the function of gathering.
It will have order when saying the row.
However, there is no order in it when saying the gathering.

In the function of C language, one exception is excluded, and there is no concept of order at all.
The program structure of C language : in the structure that various functions become the person hardening.
Each function can be used in favorite the order.

It returns to contents.


[2] How to make function

I see ..sets of functions it... the program structure of C language
Then, it is a structure of the function naturally that becoming a problem next.

The function of C language has a very clear structure. The following are the structures of the function of C language.

[ Structure of   function   ]
Type name   function name (argument)Processing
The type name is a kind of of the numerical value used when the function returns the numerical result.
Here, remember the type named int ([into]) for the time being.
Int means the integer.

The function name is literally a name of the function.
In how to give this name, there is regulations like the under.

[ Rule at the previous state of   person   ]
1, normal-width alphabet, normal-width figure, and normal-width _ (under bar) can be used.
The first two characters, the figure cannot be used.
3 and the reserved word decided beforehand cannot be used.
The reserved word is a key word used in C language.
However, the number of these reserved words must worry too much never because it is few.

Though it doesn't care about any name if it meets the requirement ahead
Will use the name of main (main) for the time being this time.

[   Reserved identifier   ]
Another and the identifier of the reserved word that has been reserved cannot be used by C language as a name.
The reserved identifier is a name used internally.
The name that the capital letter leads to under a bar cannot be used.
The name used by C language standard cannot be used.
The argument is a kind of of the numerical value passed to the function.
The function can return the result by calculating based on the passed numerical value.
However, any this purpose is to make the program not done as described in the start.
Information need not be passed to the program that doesn't do anything.
Then, will use void (Boyd) that shows that there is no information.

Processing is processing as shown in the name.
Any this purpose is to make the program not done as described in the start
This time, the processing that should be only done includes processing that ends the function.
Use return (return) sentence to end the function.
Though the function to return the numerical value of the numerical result is provided in the return sentence
It makes it to 0 for the time being because it is a program that doesn't do anything this time.

As mentioned above was done, and the following functions were completed.

 int main(void) {return 0;} 
It has not explained yet. [Ni], it will explain later.

It returns to contents.


[3] The main function specially :.

Well, want to do the programming by immediately using the completed function, and
However, only another one might have to be known ahead of that.

In clause 1, it explained that order did not exist in the function.
However, having embarrassed it by one happens with this.
It hesitates from which function to only have to mark down the first first.

In C language, this problem is solved by a very simple method.
In C language, the first function named main has been decided operation at the beginning.


[ Meaning of   main function   ]
In C language, at the beginning, the first main function operates.
When there is no main function in the program anywhere
Because the function of beginning of the first is lost, the program cannot be operated.
The program of C language can be operated as long as there is main function if it says oppositely.

Because the name is main in the function made ahead
If this function exists, the program can be operated.

It returns to contents.


[4] Operate the program.

Then, let's have them immediately execute the program.
It is a program that doesn't do anything that this made this time.

 int main(void) {return 0;} 
Drive this program according to the explanation of the compiler.
However, do not copy, do not paste the text of a browser, and do not apply it.
Drive it from the keyboard to become accustomed to driving the program.

Operate it immediately when you drive it.
The execution result of this program becomes as follows.


Nothing seems to be displayed. It resulted the same as this target.
Though it is thought that various texts are displayed in a lot of environments
It doesn't relate and disregard them with the operation of the program.

It returns to contents.


< - It is advanced -> | in | head that returns  to returning  next |.