请告诉程序输出 [英] please tell the output of the program
本文介绍了请告诉程序输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
#include
main()
{
char *q;
int *ip;
q=(char*)malloc(100);
ip=(int*)q;
free(ip);
}
推荐答案
结果"没有显示在屏幕上. (我假设#include指向stdio.h,否则结果是一堆编译器错误)
运行后,您将分配100个字符的内存.然后,将指向该内存块的指针复制到(a)* q和(b)* ip.
您可以释放分配的内存并退出程序.
我应该提到需要将main声明为返回一个int(除非您使用的是恐龙走过地球时的编译器)
The ''result'' is nothing displayed on screen. (I''ll assume that #include refers to stdio.h, otherwise the result is a bunch of compiler errors)
Once running, you allocate memory for 100 chars. You then copy a pointer to this memory block into (a) *q and (b) *ip.
You free the memory you allocated and exit program.
I should mention the need to declare main as returning an int (unless you''re using a compiler that was around when dinosaurs walked the earth)
这篇关于请告诉程序输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文