From the course: C Essential Training

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Specifying integers and real numbers

Specifying integers and real numbers - C Tutorial

From the course: C Essential Training

Start my 1-month free trial

Specifying integers and real numbers

- [Instructor] Numbers in C come in two flavors: the int data type stores integers or whole number values and the float or doubled data types store, real numbers are those that contain a decimal portion or a very large or very small. Integers in your code are written without commas for large values as shown here at line five. Real numbers always specify the decimal part. At line six, a float variable is declared and the 0. is required. You can't just do .25. Well, maybe a can. Always put the zero in there to show that the value is a real number. And at line seven, the value 1 billion adds on the .0 again to tell the compiler that this is a real number and not the integer value 1 billion. This exercise file provides a quick test. Build and run. And I'm going to type 100 million. And you see that it works. Now, I'm going to run it again. And this time I'm going to type the commas, just as you would when you write someone a…

Contents