[ create a new paste ] login | about

Link: http://codepad.org/9sA0V70h    [ raw code | output | fork ]

C, pasted on Apr 12:
//
//  w.c
//  csample
//
//  Created by leon on 4/11/15.
//  Copyright (c) 2015 leon. All rights reserved.
//

#include<stdio.h>
typedef struct _StruckA{
    unsigned int val1;
    unsigned char bSuccess;
    unsigned int val2;
    unsigned char bInitialize;
}structA, *pStructA;
int main(){
    structA a;
    a.val1 = 0x12345678;
    a.bSuccess = 0;
    a.val2 = 0xABCDEF01;
    a.bInitialize = 1;
    //请给出变量a在x86,x64下的内存分布情况
    printf("%d\n",sizeof(a));
    printf("%p\n",&a);
    printf("%p\n",&a.val1);
    printf("%p\n",&a.bSuccess);
    printf("%p\n",&a.val2);
    printf("%p\n",&a.bInitialize);
    return 0;
}


Output:
1
2
3
4
5
6
16
0xff90f16c
0xff90f16c
0xff90f170
0xff90f174
0xff90f178


Create a new paste based on this one


Comments: