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 - C Tutorial
From the course: C Essential Training
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Understanding C language data types3m 4s
-
Declaring variables2m 49s
-
Working with variables2m 55s
-
Exploring the printf() function3m 4s
-
Using constants2m 53s
-
Challenge: Make variables and constants47s
-
Solution: Make variables and constants1m
-
Understanding variable scope3m 8s
-
Making new data types3m 24s
-
Specifying characters and strings3m 17s
-
Specifying integers and real numbers4m 14s
-
Typecasting a variable3m 11s
-
Challenge: Basic I/O1m 10s
-
Solution: Basic I/O1m 35s
-
-
-
-
-