/* * ===================================================================================== * * Filename: point.c * * Description: * * Version: 1.0 * Created: 2013年03月12日 14时17分25秒 * Revision: none * Compiler: gcc * * Author: YOUR NAME (), * Organization: * * ===================================================================================== */ #include <stdio.h> typedef unsigned int uint32; typedef unsigned short uint16; typedef unsigned char uint8; void test( uint8 *a ) { a[0] = 0x1; a[1] = 0x2; return; } //强制类型转换不对起本身转换,只对他本次的操作转换(初始化是什么类型还是什么类型,转换只是本次转换为别的使用) int main(int argc, const char *argv[]) { int x = 0x12345678; printf("0x%x\n", (char)x); test((uint8 *)&x); printf("0x%x\n", (uint16)x); printf("0x%x\n", x); return 0; }