如何消除void *这样的警告和返回预期值
#include <stdio.h>
int p(void *i)
{
return (int *)i;
}
int main()
{
int *i;
int n = 99;
i = &n;
printf("====== %d =====\n", p(i));
}
test2.c: In function ‘p’:
test2.c:5: warning: return makes integer from pointer without a cast
[解决办法]
return *((int *)i);