"Good programmer notes Sharing" memory analysis of variables in C language

Source: Internet
Author: User

#include <stdio.h>/*1. Memory addressing from large to small, priority allocation memory address larger bytes to the variable 2. The more the variable is defined, the greater the memory address is 3. Gets the address of the variable:& variable name 4. Output Address:%p 5. A variable must be advanced to initialize in order to use*/intMain () {//memory addressing from large to small    intA =Ten; intb = -; intC; //& is an address operator that gets the address of the variable//%p used to output addresses//0x7fff56f09bc8printf"the address of A is:%p\n", &a); //0x7fff56f09bc8printf"The address of B is:%p\n", &b); //0X7FFF56F09BC4printf"the address of C is:%p\n", &c); //0x7fff56f09bc0//int d = c + 1; //since the variable c is not initialized, it is not right to use it directly .printf"the value of C is%d\n", c); //the value of C is 1606416536    return 0;}/*int A; with int a=0 initialization difference*/voidTest () {intA; printf ("the value of a is:%d\n", a); //the value of a is: 1606422622    {        intA=0; printf ("the value of a is:%d\n", a); //the value of A is: 0    }}

650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; border-bottom:0px; border-left:0px; Display:inline "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/5B/F1/wKioL1UXxNOQTPdfAAC_ Mavoksy110.jpg "" 598 "height=" 202 "/>

"Good programmer notes Sharing" memory analysis of variables in 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.