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

Writing Rules

token
Japanese sentences can be written as characters, words, sentences, paragraphs, and so on.
It can be broken down into the various elements that make up a sentence.
C programs can be decomposed in the same way.

When a C program is grammatically decomposed, the smallest unit is the token.
A token is, in essence, a word. For example, a program that begins with

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

but if we break this down token by token, we get the following

Token splitting
 int
main
(
void
)
{
return
0
;
}

The reason for calling a token the smallest unit is that further decomposition would change its meaning.
For example, if return is broken down into return, an error will be displayed and the operation will fail.
free format
The C language is free-format , or free-format.
There are few restrictions on how programs can be written, so they can be written in any way you like.

Keywords.
Free format

Loose restrictions on how programs can be written, allowing free writing.


There is only one clear rule in writing C programs.
That is to say, tokens should not be written connected to each other.
For example, you should not write your first program as shown below.

Token Binding
 intmain(void) {return 0;}

In this example, the problem is that int and main are attached to each other.

However, as you can see from the program we started with, there are exceptions.
That is to say, symbols may be written by connecting them.
In the first program I created, (){}; and so on were written by connecting them together.

This is because symbols are pre-determined single characters and can be distinguished even when connected.
In the case of intmain, this appears to be nothing more than the token intmain, no matter how you look at it.
However, if it is main(void), it is obvious that it is main, (), void.

In C programs, this is the only rule of writing.
Anyway, as long as it is written without connecting any tokens other than symbols, it will be recognized.
In fact, even this program compiles without problems.

Source Code
 int
main
(
void
)
{
return
0
;
}

Other rules
There are other writing rules in C apart from the rules just described.
First, the C language is case-sensitive.
For example, main, MAIN, and maIN are interpreted as completely different tokens in C.
Therefore, when typing your program, be careful of the difference in case.

Also, in C, the ; symbol is supposed to be written at the end of a statement.
In the previous program, the return statement was terminated with a ;.
If you forget to do this, you will get an error.

One thing to note is that the C language cannot recognize double-byte characters.
You can use double-byte characters for things like strings displayed on the screen, but
The program itself must be typed entirely in half-width characters.

Full-width space trap
A mistake people make when writing programs is double-byte spaces.
Since a full-width space is also a double-byte character, the compiler assumes it is a mistake.
If you are using a text editor that does not display full-width spaces
It is hard to tell where the mistake is.



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