From the course: C Essential Training
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Specifying characters and strings - C Tutorial
From the course: C Essential Training
Specifying characters and strings
- [Instructor] To declare a single character literal in your code, sit the character between a pair of single quotes as shown here. For untypable values, like Enter or Tab, use an escape sequence. These characters, and yes, they're interpreted as a single character, start with a backslash and then some type of character code. You can also escape specific values as a single character, such as hexadecimal value 41, which is shown as \X41. Though multiple characters are used in these expressions, the escape sequence remains a single character value. This list shows common escape sequences for single characters. The new line is the one you see most often, which inserts the Enter key press into a string, or it can be used as a single character. If you want to specify a single quote character, you can use the backslash single quote within single quotes and string literals with double quotes inside must have the internal…
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
-
-
-
-
-