[Study Notes] [C Language] assignment, learning notes assignment

Source: Internet
Author: User

[Study Notes] [C Language] assignment, learning notes assignment
The process of assigning a value to a variable is called a value assignment. 1. Simple assignment

The C language specifies that variables must be defined before they can be used. You can also define and assign values in the same statement.

Int a = 10 + 5; Operation Process

A = B = 10; calculation process

The left side of the equal sign cannot be a constant, for example, 10 = 11;

2. compound assignment

Complex addition, subtraction, multiplication, and Division remainder: a + = 4 + 5;

 

1 # include <stdio. h> 2 3 int main () 4 {5 int a = 10; 6 7 // a = a + 5; 8 9 // composite assignment operator 10 a + = 5; // a = a + 5; 11 12 a * = 5; // a = a * 5; 13 14 a + = 5 + 6 + 4; // a = a + (5 + 6 + 4); 15 16/* 17 1.18 */19 a = 5 + 6*5 + 8; 20 21 printf ("the value of a is % d \ n", a); 22 23 24 return 0; 25}

 

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.