#include
#include
int main(void)
{
unsigned long l1 = 0xffffffff;
int *j, *k, i = 2;
// *k = 4; 错误用法,只为指针分配了空间, 还没为内存指向分配空间, 程序将core dump.
k = malloc(sizeof(int));;
j = malloc(sizeof(int));;
*k = 4;
// free(k);
free(j);
j = k, k = &i;
// k = &i;
printf("test j:%d,k:%d\n", *j, *k);
/*
if (l1 = ~0U)
printf("test1:%lu,%d\n", l1, l1);
else
printf("not equal test1:%lu,%d\n", l1, l1);
printf("test, int:%d, unsigned int:%d, unsigned long:%d\n", sizeof(int), sizeof(unsigned int), sizeof(unsigned long long));
*/
return 0;
}
阅读(1339) | 评论(0) | 转发(0) |