Home >Backend Development >C#.Net Tutorial >What is the integer division symbol in C language?

What is the integer division symbol in C language?

烟雨青岚
烟雨青岚Original
2020-06-30 11:38:1232511browse

The integer division symbol in C language is the "/" symbol. What should be noted with the integer division operator (/) is that the operation result will be automatically converted to the same data type as the dividend.

What is the integer division symbol in C language?

In C language, integer division is the / symbol, and the % symbol is the remainder operator.

What you need to note about the integer division operator (/) is that the operation result will be automatically converted to the same data type as the dividend.

Examples are as follows:

int a=5, b=2;
float c;
c = a/b; 
 // 运算结果为2.0,而不是2.5,因为a是int型的,所以计算结果会转换为int型,
 // 而c又是float型的,所以最后将整型的2转换为float型。

Recommended tutorial: "C Language"

The above is the detailed content of What is the integer division symbol 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