From the course: Complete Guide to C Programming Foundations
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Specifying characters and strings - C Tutorial
From the course: Complete Guide to C Programming Foundations
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, 'A' '.' '3'. For characters, you can't type like enter and tab, use an escape sequence literal. These characters, and yes, they're interpreted as single characters, start with a backslash and then a special character. 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, this escape sequence remains a single character value. This list shows common escape sequences for single characters. The new line is one escape sequence you see most often. It inserts the enter key press into a string, or it's used as a single character. If you want to specify a single quote character, you use \" within single quotes. And string literals with double quotes inside must have the internal double quote character escaped. This code prompts for single character input. Escape…
Contents
-
-
-
-
Understanding C language data types3m 17s
-
(Locked)
Declaring variables2m 53s
-
(Locked)
Working with variables3m 4s
-
(Locked)
Exploring the printf() function3m 48s
-
(Locked)
Using constants2m 58s
-
Challenge: Making variables and constants53s
-
(Locked)
Solution: Making variables and constants1m 16s
-
(Locked)
Understanding variable scope3m 35s
-
(Locked)
Making new data types3m 25s
-
(Locked)
Specifying characters and strings3m 17s
-
(Locked)
Specifying integers and real numbers3m 55s
-
(Locked)
Typecasting a variable2m 20s
-
(Locked)
Chapter challenge: Adding variables and constants1m 10s
-
(Locked)
Chapter solution: Adding variables and constants2m 7s
-
-
-
-
-
-
-
-
-
-