IPhone C Basics on the second day

Source: Internet
Author: User

Today we are mainly talking about the basis of C. This time we will mainly explain it in detail by code.
First of all, the biggest headache is the difference between a = I ++ and a = ++ I. a = I ++ first assigns a value and then increases itself, a = ++ I is auto-incrementing first and then assigned a value.
 
 
Int I = 5;
 
 
 
Int B = I ++;
 
Int c = I;
 
 
 
Printf ("B = % d \ n", B );
 
Printf ("c = % d \ n", c );
 
 
 
 
 
Int a = ++ I + (B ++ );
 
 
 
Printf ("a = % d \ n", );
 
Printf ("B = % d \ n", B );
 
 
 
Int d = I + B;
 
Printf ("d = % d \ n", d );
 
 
 
 
Printf ("*********************** \ n ");
 

 
Int z = 1;
 
Int j = z ++;
 
// J = 1 z = 2
 
Printf ("z = % d", z );
 
Printf ("j = % d \ n", j );
 
J = ++ z;
 
// J = 3 z = 3
 
Printf ("z = % d", z );
 
Printf ("j = % d \ n", j );
 
J = z --;
 
// J = 3 z = 2
 
Printf ("z = % d", z );
 
Printf ("j = % d \ n", j );
 
J = -- z;
 
// J = 1 z = 1
 
Printf ("z = % d", z );
 
Printf ("j = % d \ n", j );
 



 
Printf ("*********************** \ n ");
 
 
Any language will use judgment. Let's talk about if else first.
 
Printf ("*********************** \ n ");
 

 

 
I = 0;
 
If (I ){
 
Printf ("true \ n ");
 
} Else {
 
Printf ("false \ n ");
 
}
 
Printf ("********************** \ n ");
 
Determine the maximum number of three values without using the median.
 
Printf ("********************** \ n ");
 

 
A = 8;
 
B = 4;
 
C = 1;
 
Int max = 0;
 
If (a> B ){
 
If (a> c ){
 
Max =;
 
} Else {
 
Max = c;
 
}
 
} Else {
 
If (B <c ){
 
Max = c;
 
} Else {
 
Max = B;
 
}
 
}
 
Printf ("max: % d \ n", max );
 
Printf ("********************** \ n ");
 
Switch statement
 
Printf ("********************** \ n ");
 

 
Char char_grade;
 
Printf ("Enter :");
 
// Scanf ("% c", & char_grade );
 

 
Switch (char_grade ){
 
Case 'A ':
 
Printf ("90-100 \ n ");
 
Break;
 
Case 'B ':
 
Printf ("80-90 \ n ");
 
Break;
 
Case 'C ':
 
Printf ("70-80 \ n ");
 
Break;
 
Default:
 
Printf ("enter \ n" again ");
 
Break;
 

 
}
 

 
Printf ("********************** \ n ");

Author 10-3G-Cheng Long

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.