Unary operators work with single variables or expressions, such as the sizeof operator—also a keyword—that returns the amount of storage used by a variable, array, or chunk of memory or the not operator that negates a condition. Unary operators are unique in that they don't require two values.
- [Instructor] C language Unary Operators affect … only one variable. … The name Unary comes from the Latin onus one. … And here's the full list of operators, … including the size of operator, … which is both an operator and the C-language keyword, … it deserves a bit of exploration … size of works on a variable array or chunk of memory. … It returns a size_t value, … which is an unsigned positive integer … representing the number of bytes of memory … the item occupies. … To use the size_t type death. … You must include the stdio.h header file in your code. … This operator is used most often when allocating memory … or dealing with pointers. … In this code, … six variables are declared … the four standard character, integer, float and double. … I'm also added a string or character array … and a buffer capable of storing 10 integers. … For each of these items a printf statement, … uses the size of operator, … to output how many bytes each item occupies … in memory build and run. … The value shown here might not be the same …
- 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.