MMGames Introduction to C C Language Development Environment C language now Useful Apps Contact Us
MMGames

Automatic version identification

SpineViewer

It's easy to tell by looking at it.

Response Time Checker

I can leave my computer on and do it.

Mouse cleaning time

I can leave my computer on and do it.

Mouse cleaning time

C language learned by suffering
C language learned by suffering

Programs that do nothing

C Language Structure
We will now create our first program in C.
However, it is impossible to create a program with many different functions from the beginning, so
We start by creating a program that has no function and does nothing.

By the way, what kind of knowledge is needed to create a C program?
Whatever you are going to make, you will not be able to make it without knowing its structure.
To build a bookshelf, you need to know the structure of a bookshelf, and the same is true for the C language.

So what exactly is the structure of the C language?
When building a machine, we put together various components.
Similarly, programming combines parts. These parts are called functions.
In other words, a C program is made up of a collection of functions.

Structure of C Language Programs
A C program is made up of a collection of functions.

It is important to note that this is a collection of functions, not a sequence of functions.
When we speak of a sequence, we mean that it has an order.
However, when we speak of a collection, there is no order to it.

With one partial exception, C functions have no concept of order at all.
The structure of a C program is a collection of various functions, each of which is called a "function".
Each function can be used in any order.
How to Create Functions
We have seen that the structure of a C program is a set of functions.
Then, the next problem is naturally the structure of functions.

Functions in C have a very clear structure. The following is the structure of a C function.

Function Structure
Type Function name (Argument) {Processing}

A type name is the type of number that a function uses to return the result of a calculation.
Here, for now, remember the type int (int).
The word int means an integer.

A function name is literally the name of a function.
The naming convention is as follows.

Name Conventions
1, One-byte alphabets, one-byte numbers, and one-byte _ (underbar) can be used.
2. Numbers cannot be used as the first character.
3、Pre-determined reserved words cannot be used.

Reserved words are keywords used in the C language.
However, the number of these reserved words is small and not very important.


Any name is acceptable, as long as it meets the requirements I mentioned earlier.
For now, we will use the name main (main).

reserved identifier
In C, reserved words as well as reserved identifiers cannot be used as names.
A reserved identifier is a name that is used internally, and
Names followed by an underscore capital letter cannot be used, and
The standard names used in the C language cannot be used.

An argument is a type of number that is passed to a function.
Functions can perform calculations and return results based on the numbers passed to them.
However, as mentioned at the beginning, the purpose of this project is to create a program that does nothing.
There would be no need to pass information to a program that does nothing.
Therefore, we will use void, which represents the absence of information.

Processing is exactly what the name implies.
As I mentioned at the beginning, our goal this time is to create a program that does nothing.
The only process that must be done this time is to terminate the function.
To terminate a function, use the return statement.
Note that the return statement has the ability to return the numerical value of the result of the calculation.
In this case, since the program does nothing, we will leave it at 0 for now.

With the above, the following function is completed.

source code
 int main(void) {return 0;}

The {} and ; are explained later.
The main function is a special
Now, let's get right to programming with the completed function...
But first, there is one more thing you need to know.

In section 1, we explained that there is no order in functions.
However, this leaves one in a bind.
First of all, I am not sure which function to look at first.

The C language solves this problem in a very simple way.
In the C language, the function named " main " is determined to be the first to work.

Meaning of main function
A C program is made up of a collection of functions.
In C, the main function is the first one to work.

If the main function is nowhere to be found in the program, then the
Since the first function is gone, the program cannot work.
Conversely, a C program can run as long as it has a main function.

The function we just created is named main.
With this function, the program can be made to run.
Running the program
Now, let's run the program.
This is the program we created that does nothing.

source code
 int main(void) {return 0;}

Type this program according to the compiler's instructions.
However, do not copy and paste text from your browser.
To familiarize yourself with typing the program, please type it from the keyboard.

If you do not already have a compiler, please download it here.
Learning C Language Development Environment

After typing it in, try to get it running as soon as possible.
The result of executing this program will be as follows

Execution Result

Nothing seems to be showing up. Congrats!
The results were in line with our goal of creating a program that does nothing.
Note that in many environments, you will see a variety of text.
They have nothing to do with the operation of the program and should be ignored.


About this Site

The C language (bitter C), which is learned by suffering, is
This is the definitive C language introductory site.
It systematically explains the basic functions of the C language and
It is as complete as or more complete than any book on the market.

Part 0: Program Overview
  1. What is the program?
Chapter 2: How to write a program
  1. Writing Rules
  2. Writing conventions
  3. Exercise 2
Chapter 3: Display on Screen
  1. String display
  2. newline character
  3. Exercise 3
Chapter 4: Numeric Display and Calculation
  1. Numeric Display
  2. Basic Calculations
  3. Type of value
  4. Exercise 4
Chapter 5: Numerical Memory and Calculation
  1. Memorize values
  2. Variable Type
  3. Type conversion
  4. Numeric justification
  5. Exercise 5
Chapter 6: Input from the keyboard
  1. Functions for input
  2. Fear of Input
  3. Exercise 6
Chapter 9: Repetition with a fixed number of times
  1. Sentences that repeat themselves
  2. Loop Operation Mechanism
  3. Exercise 9
Chapter 10: Unknown number of repetitions
  1. Loop of unknown frequency
  2. input check
  3. Exercise 10
Chapter 13: Handling Multiple Variables at Once
  1. Multiple variables are handled together.
  2. How to use arrays
  3. Exercise 13
Chapter 19: Dynamic Arrays
  1. Create arrays at will
  2. Exercise 19
Chapter 20: Multiple Source Files
  1. Minimal division
  2. The Stone of Partition
  3. Exercise 20

Comment
COMMENT

Open the 💬 comment submission box