我想将 int
传递给需要 char *
的函数。
函数头如下所示:
void swapEndian(char *pElement, unsigned int uNumBytes)
并使用 int 调用函数(我知道,这行不通..)
int numLine;
swapEndian(numLine, sizeof(int));
那么我必须对 numline 做些什么才能将它传递给这个函数?
最佳答案
听起来好像你只是想要:
swapEndian( (char*) &numLine, sizeof(int) );
关于c - 将 int 传递给需要 char* 的函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13309139/