两道C题
1)(指针) %p 是做什么用的?是要显示地址还是其他什么? (你也能举个例子吗?)
2)与使用graph.h库和创建图形一样,ellipse()函数有6个参数。它们是什么?我找不到它们的完整列表。
谢谢
编辑抱歉。它应该是
库。是的,它是一个希望我们使用的外部库。 ps:不是作业。
1)(pointer) What is %p used for? To show the address or something else? (can you give example too?)
2) As using graph.h library and creating graphs, ellipse() function has 6 parameters. What are them? I could't find full list of them.
Thank you
edit sorry. it should be <graphics.h>
library. and yes, it is an external library that wanted us to use.
ps: not homework.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
%p
用于使用printf
打印出指针的值(地址):我不知道什么
graph.h 你指的是,我怀疑其他人也这样做;您能发布有关该库用途的更多信息吗?
%p
is used to print out a pointer's value (the address) usingprintf
:I have no idea what
graph.h
you're referring to, and I doubt many others do either; could you post more information on what that library is for?一些网络搜索表明
graphics.h
是一个Borland扩展,并且它确实包含一个带有六个参数的ellipse
函数。我在这里找到了一些文档:http://www.cs。 colorado.edu/~main/cs1300/doc/bgi/ellipse.html
您应该知道此功能尚未标准化,因此其他 C 实现可能没有它。
Some web searching indicates that
graphics.h
is a Borland extension, and it does indeed contain anellipse
function that takes six arguments.I found some documentation here: http://www.cs.colorado.edu/~main/cs1300/doc/bgi/ellipse.html
You should be aware that this functionality is not standardized, so other C implementations may not have it.
这看起来像是家庭作业,因为 graph.h 不是少于 20 个标准标头中的一个。所以我们只能猜测椭圆函数将什么作为参数。也许是 x、y、宽度、高度、起始角度、角度。也许是左、上、右、下、起始角度、结束角度。谁知道?
%p 用于打印指针的字符串表示形式,通常称为对象的地址。所以是的,你写的听起来是正确的。
This looks like homework, since graph.h is none of the less-than-twenty standard headers. So we could only guess what the ellipse function takes as parameters. Maybe it's x, y, width, height, start_angle, angle. Maybe it's left, top, right, bottom, start_angle, end_angle. Who knows?
The %p is for printing the string representation of a pointer, which is usually called the object's address. So yes, what you write sounds correct.
1)我不确定 %p 对于指针而言意味着什么,但是您使用 *p 来引用指针(获取其值),并且使用 &y 将变量分配给指针(请参阅 Mehrdad 的回答) printf 的用法)。
整数y=9;
int* x = &y;
2)没有默认的“graph.h”库。你用的是boost还是mingw?
1) I'm not sure what %p means in regards to a pointer, but you use *p to deference a pointer (get its value), and you use &y to assign a variable to a pointer (see Mehrdad's answer for printf usage).
int y =9;
int* x = &y;
2) There is no default "graph.h" library. Are you using boost or mingw?