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

What does real mean in c language

下次还敢
Release: 2024-05-09 12:06:16
Original
715 people have browsed it

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>
Copy after login
  • 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>
Copy after login

Output:

<code>3.141593</code>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template