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

Variable Type

data type
In the previous section, we discussed variable declarations and their usage.
When declaring a variable, we have explained little about its type.

In the previous section, we explained that to declare a variable, use the following writing style

Declare variables
Type name Variable name;

A type name is an example of the type of number you want to remember.
In the previous section, we used int to store integers, but
There are many other types of this type.

The C language can handle many different types of numbers.
And for each number, a separate type of variable must be used to store it.
These different types of numbers are sometimes referred to as data types.

Keywords.
[Data type

A type of numerical value. The maximum number of digits, whether it is an integer or a real number, and so on.


In C, each of those types is named separately.
And the names are often referred to as what-types.
Variable to store real numbers
There are not many types of data types used in the C language.
For the time being, you only need to remember the following two.

Type name Numeric Type
int integer
double real number

The variable we just used was of type int.
Apart from that, another type of variable called double (double) type can also be used.
While type int stores integers, type double stores real numbers.

The two are used in exactly the same way, just for different types of numbers to be stored.
The following program is an example of using the double type to perform four arithmetic operations.

Source Code
 #include <stdio.h>

int main(void)
{
    double left, right;
    left = 10;
    right = 3;
    printf("%f\n", left + right);
    printf("%f\n", left - right);
    printf("%f\n", left * right);
    printf("%f\n", left / right);
    return 0;
}

The result of executing this program will be as follows

Execution Result
13.000000
7.000000
30.000000
3.333333

If you compare it with the previous program, you will see that the usage is exactly the same.


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.