(original) C # learning note 03--variables and expressions 03--variables 04--variables Declaration and assignment

Source: Internet
Author: User

Declaration and assignment of 3.3.4 variables

The first is to declare multiple variables of the same type at the same time, by separating the variable names with commas after the type, as shown below.

int xsize, ysize;

Where both xsize and ysize are declared as integer types.

The second technique is to assign values to the variables as they are declared, merging the two lines of code together:

int age = 25;

You can use both techniques at the same time:

int xsize = 4, ysize = 5;

Xsize and ysize are given different values. Note the following code:

int xsize, ysize = 5;

The result is that ysize is initialized, and xsize is only declared, and still needs to be initialized before it can be used.

(original) C # learning note 03--variables and expressions 03--variables 04--variables Declaration and assignment

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.