Variables are containers for storing data that can change as a program runs. In C, it's important to note that variables are not initialized and that they must be declared of a specific data type and used appropriately to be effective in the code.
- [Instructor] A variable is a storage container you use … in your code that hold things that can change. … The variable must be declared before it's used. … It's given a data type and a name. … It can also be initialized to a given value … though this assignment can come later. … Variables are declared in a statement typically at the top … of the function as shown here in the main function … at lines five through seven. … So character variable c, integer variable i, … and float variable f. … You can also declare a variable elsewhere in the code. … So down at line 17, … double d is declared. … Providing that the variable is declared before it's used, … you're good. … Using a variable that's not declared generates a warning. … So back down at line 17, … I'm going to comment out this line. … Here we go. … It's disabled. … I'm going to save the change and build, … and check the build messages tab. … You see that variable d is used, … but it's undeclared. … A variable name must start with a letter …
- 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.