In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces "what are C language escape characters and how to use them". In daily operation, I believe many people have doubts about what C language escape characters are and how to use them. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about what C language escape characters are and how to use them. Next, please follow the editor to study!
What is an escape character
Simple understanding: a character that can convert the meaning of a character.
Summary table of escape characters
Detailed explanation of common escape characters
1 escape character "\?"
Function: used when writing consecutive question marks to prevent them from being parsed into three-letter words
2 escape character "\"
Function: used to represent character constants
For example:
# includeint main () {printf ("\"); / / will print a'(single quotation mark) return 0;}
3 escape character "\"
Function: used to indicate double quotation marks inside a string
For example:
# includeint main () {printf ("\"); / / will print "(double quotation marks) return 0;}
4 escape character "\"
Function: used to represent a backslash to prevent it from being interpreted as an escape sequence.
For example:
# includeint main () {printf ("\"); / / will print out\ (backslash) return 0;}
5 escape character "\ a"
Function: warning character, buzzing.
6 escape character "\ n"
Function: line break
For example:
# includeint main () {printf ("abc\ ndef"); / / will print abc and def in two lines return 0;}
6 escape character "\ r"
Function: enter
7 escape character "\ t"
Function: horizontal tabs
Description: equivalent to pressing the tab key on the keyboard.
8 escape character "\ ddd"
What it does: ddd represents 1 to 3 octal numbers. Such as:\ 130
For example:
# includeint main () {printf ("% c\ n",'\ 130'); / / print X / / octal: 130 / / 10: 88 (SCII:X) return 0;}
9 escape character "\ xdd"
Purpose: dd represents 2 hexadecimal digits. Such as:\ x44
For example:
# includeint main () {printf ("% c\ n",'\ x44'); / / print D / / hexadecimal: x44 / / 10: 68 (SCII code: d) return 0;} Summary
After introducing the above, how on earth do you use escape characters? Let's explain it with a title.
Topic: print\ test\ 628\ test.c
For example:
# includeint main () {printf ("\\ test\\ 628\\ test.c\ n"); / / the\ t horizontal tab / /\ 62 octal / / to prevent them from being escaped, we need to add "\" return 0 At this point, the study of "what are the escape characters in C language and how to use them" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.