Created
March 7, 2019 03:09
-
-
Save bob910078/d6d10ee59a4dbe63b3362c76e3136e63 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// main.c | |
// test | |
// | |
// Created by Bob Chang on 2019/3/2. | |
// Copyright © 2019 Bob Chang. All rights reserved. | |
// | |
#include <stdio.h> | |
void Test(int **ptr){ | |
int Bb; | |
Bb = 2; | |
*ptr = &Bb; | |
} | |
int main(int argc, const char * argv[]) { | |
typedef unsigned char UINT8; | |
typedef unsigned short UINT16; | |
typedef unsigned int UINT32; | |
// insert code here... | |
typedef union{ | |
UINT32 a; | |
struct aa{ | |
UINT16 b; | |
UINT16 c; | |
}aa; | |
struct bb{ | |
UINT8 d; | |
UINT8 e; | |
UINT8 f; | |
UINT8 g; | |
}bb; | |
}test; | |
test tt; | |
tt.a = 0x12345678; | |
printf("a = %x, b = %x, c = %x, d= %x, e = %x, f = %x, g = %x\n",tt.a, tt.aa.b, tt.aa.c, tt.bb.d, tt.bb.e, tt.bb.f, tt.bb.g); | |
// Output: a = 12345678, b = 5678, c = 1234, d= 78, e = 56, f = 34, g = 12 | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment