Constants are values that don't change in your source code, defined as a specific data type, and used literally in the code or declared by using the const keyword or created by the #define preprocessor directive. Understanding how and when to use constants can greatly improve any programmer's productivity.
- Constants are values used in your code that never change. … They can appear immediately as a literal value, … or you can declare a constant expression. … On line seven, you'll see four and five. … These are literal values. … And the sum of these values is assigned a variable a, … which is then output at line eight in this printf statement. … I'll build and run and you see four plus five equals nine. … All is right in the universe. … In this code, a parade of putchar functions … output single character literals. … Constants, one after the other, … each specified as the argument to the function. … Build and run. Hello. … A string literal is any text enclosed in double quotes … as shown at line five. … The puts function at line seven outputs this string literal. … The constant declaration in this code … works like a combination of literal value and variable. … Line five looks like a variable declaration and it is. … Integer variable count is declared … and it's initialized to the value four. …
- Writing your first C program
- Working the C development cycle
- Adding comments to code for clarity
- C language data types
- Declaring variables
- Making new data types
- Typecasting variables
- Using math, assignment, and logical operators
- Creating for and while loops
- Nesting loops
- Creating functions
- Returning values from functions
- Passing arguments to functions
- Creating recursive functions
Skill Level Intermediate
C: Data Structures, Pointers, and File Systemswith Dan Gookin2h 57m Intermediate
1. The Fundamentals of C
2. Variables and Values
3. Operators and Math
4. Decisions and Loops
Next steps1m 38s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.