A deep understanding of the C language-the difference between ' 0 ', ' 0 ' and ' 0 ' __c language

Source: Internet
Author: User
It seems that the foundation is still very important, the foundation is not solid hard to learn C language, do not say to write high quality C language code. Today, I was tortured by this problem, haha, but now finally understand the ' 0 ', "0" between the difference. Confused and happy to share with you.

First, compare the difference between ' the ' and ' 0 '. One thing we have in common is that they are all characters, and in C, characters are stored in their corresponding ASCII code, one character for one byte. Please open your ASCII character set, generally in your C language textbook appendix, no words on the Internet check Oh. Take a look at the first ASCII code, the pair is 0, the corresponding character Fu Shi (null), is actually ' "", that is, the null character. The flag to determine whether a string is closed is to see if a ' yes ' is encountered, and if ' yes ' is encountered, the end of the string. and the ASCII code corresponding to the character ' 0 ' is 48,48, and the hexadecimal number is 0x30, usually when we are programming, we often use characters to convert to numbers, such as converting the ' 8 ' to the number 8, which is written in the statement, "8+ ' 0". Here's 8 is the number. The difference between the character ' 0 ' and the number 0: The former is a word constants, the latter is a cosmetic constant, and their meaning is different from how they are stored in the computer. But character constants can participate in related operations in programs like integers. For example: ' 9 '-3;. Haha, is not vista AH.

Next we compare the difference between "0" and "0". First "0" is a string constant, a string constant that is a sequence of characters enclosed by a pair of double quotes. For example: "We", "I Love You", "123" are all valid string constants. ' 0 ' is the amount of character constants, and the number of string constants and Word constants is different. 1: The character constants is enclosed in single quotes; string constants are enclosed in double quotes. 2: Character constants only a single character; string constants can contain one or more characters. Here we first introduce the main differences in expression, in the use of storage space and the different ways of assignment and so on. Here is just a guide, specific reference to C-language related books. I hereby summarize, hope to be useful to you, thank you.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.