- 论坛徽章:
- 0
|
各位,
若果有一個函數定義如下:
- typedef int BOOL;
- typedef signed char INT8;
- typedef signed short INT16;
- typddef signed long INT32;
- typedef unsigned char UINT8;
- typddef unsigned short UINT16;
- typddef unsigned long UINT32;
- function123(INT16 handle, UINT8 id, UINT8 *len, UINT8 *info);
复制代码
我在程序內調用這function123
- ... ...
- INT16 handle;
- UINT8 id;
- UINT8 *length;
- UINT8 *information;
- id = 6;
- function123(handle, id, length, information)
- ... ...
复制代码
請問我這樣調用function123對嗎?
但在編譯時會在 function123(handle, id, length, information) 出現警告如下:
- warning: passing arg 3 of function123 makes pointer from integer without a cast
- warning: passing arg 4 of function123 makes pointer from integer without a cast
- warning: `length` might be used uninitialized in this function
- warning: `information` might be used uninitialized in this function
复制代码
若我把length 及 information 改為
UINT8 *length = NULL;
UINT8 *information = NULL;
printf("Information is (%s)\n", information);
警告沒有了, 編譯成功, 但當想print出information時, 會是(NULL)的. 請問我應該怎樣做才是正確的調用function123從而拿取出information的資料呢.
請各位指教指教.
[ 本帖最后由 惠繪洋 于 2006-7-14 18:11 编辑 ] |
|