Home  >  Article  >  Backend Development  >  How to define variables in C language

How to define variables in C language

王林
王林Original
2020-06-16 15:29:369828browse

How to define variables in C language

The format for defining variables in C language is very simple, as follows:

数据类型  变量名;

Note: Do not lose the final semicolon. The definition of a variable is a statement, and statements end with a semicolon.

"Data type" indicates what type of variable you want to store. If you want to store integers, define it as int type; if you want to store decimals, define it as float or double type.

"Variable name" is what name you want to give this variable, usually using letters. For example:

int i;

The above statement indicates that an integer variable i is defined.

Recommended tutorial: c language tutorial

The above is the detailed content of How to define variables in C language. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn