C-language escape characters and type conversion

Source: Internet
Author: User

1, \ DDD indicates octal.

Application: \ 101 output letter,

CodeAs follows:

Char CH = '\ 101 ';
Printf ("% C", CH );

2 InC LanguageWhen forced type conversion is performed, an intermediate variable of the required type is obtained. The type of the original variable has not changed,

Float F;
Int I;
F = 3.4;
I = (INT) F;
Printf ("I = % d, f = % F", I, F );

The output of this sentence is 3 and 3.4, and the variable F is still 3.4.

 

 

3. the following code is used to combine operators:

Int II;
II = 3;
Printf ("-II ++ = % d \ n",-II ++ );
Printf ("II = % d \ n", ii)

The output result is-II ++ =-3;

II = 4. That is to say, the negative sign itself does not affect the value of II, and the value that affects II is the ++ operator.

4. In C,

Int I, J;
I = 3, j = 4;
Printf ("I ++ J = % d", I ++ J );
Printf ("\ n % d", I );

The running result of the following code is: I ++ J = 7

4

I ++ J is equivalent to (I ++) + J

In this case, the C compilation system converts as many characters as possible into operators.

 

 

 

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.