Some questions about the pointer of C language

Source: Internet
Author: User

1. Assignment problem for pointer variables.

There are always lazy lads, so assign a value

int *pointer = 3;/This is the variable assigned to Pointer, the variable it refers to is not fixed when the Pointer is created, and may be an important system variable .

This assignment does not give an error when compiling, but in fact there is a mistake. The address of the variable is the pointer to the variable, the pointer variable is the value stored by the variable is the address, assigning a pointer variable to the value of the time, first to give it a specified address,

int i = 3;

int *pointer;/At this time its value is not predictable, it may point to a storage unit that stores important data to assign values,

Pointer = &i;

printf ("%d", *pointer);

The value of this output is the value of the variable i.

Some questions about the pointer of 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.