Pointer variables for C language

Source: Internet
Author: User

      Pointer variables for C language

    In C, a variable is a fixed range of storage space, which stores the value assigned to him.

Like what:

         

        int  A ;     /* here is the definition of an integer variable A, and the value of 12 is stored in the address space of a,         the address space is the system randomly allocated, the user is transparent    do not care * *             

The pointer variable stores the address of the variable,

Like what:

    int  *b;     = &A;     /* as above, an integer variable A is defined and assigned a value of 12, an integer pointer variable b        then takes the & value operator to the address space value of variable A, stored in the pointer variable b        at this time the variable b is stored in variable A in the address space (this particular note, The pointer variable stores the address)            *///        / We can use the pointer operator * to fetch the value stored in the address space stored by the B pointer variable.     int  c;      = *b;     // now the value stored in C is the value of a.

Definition of pointer variable

int a = n, *b;

b = &a;

In programming, any variable must be defined and then assigned before it can be used, so remember Oh!

Pointer variables for C language

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.