Home >Backend Development >C#.Net Tutorial >What does real mean in c language

What does real mean in c language

下次还敢
下次还敢Original
2024-05-09 12:06:161040browse

real is the data type used to represent double-precision floating point numbers in C language. It occupies 8 bytes, has a precision of about 15 decimal places, and the range is [-1.7976931348623157e 308, 1.7976931348623157e 308].

What does real mean in c language

real in C language

What is real?

real is the data type used to represent floating-point numbers in C language. It is a double-precision floating-point number.

Features:

  • Occupies 8 bytes of space.
  • You can have a decimal part after the decimal point.
  • The precision is approximately 15 decimal places.
  • The range is approximately [-1.7976931348623157e 308, 1.7976931348623157e 308].

Declaration:

<code class="c">float variable_name;
double variable_name;</code>
  • float will declare the variable as a single-precision floating point number, occupying 4 bytes of space, and the precision is approximately 6 decimal places.
  • double declares the variable as a double-precision floating point number, that is, real.

Example:

<code class="c">int main() {
  real x = 3.14159265;  // 声明一个 real 类型变量并初始化为 π
  printf("%f\n", x);  // 输出 x 的值

  return 0;
}</code>

Output:

<code>3.141593</code>

The above is the detailed content of What does real mean 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