关于c语言既#include

 我来答
新科技17
2022-11-17 · TA获得超过5906个赞
知道小有建树答主
回答量:355
采纳率:100%
帮助的人:75万
展开全部

更新1:

有人同我讲过话写program至少一定要打#include 呢句我试过唔洗打都run到啵 究竟入面有边d function系需要用到先要打上去?


Can I wer this in English? 2009-03-30 22:30:26 补充: 究竟最上面既#include有咩用? The lines with "#" in C is for the C preprocessor "cpp". Before the piler will process the source file
the preprocessor will process the "macros" of the file. All macros are lines begin with "#" character. Good example is to use the math functions. Without the #include <math.h> line
you may not be able to get a good a.out file and will not get a clean pile. To see what the output after preprocessing looks like
you can use > cpp somefile.c You can think of using the include lines are just short hands not to type in all those function declarations. However
there are more to just that. #include lines can also be in the middle of a program and there are more than just include. It can be #define
#if ... 有时试过唔洗打呢d都run到个program 其实真实既用途系咩? Sometimes without using any include lines
the pilation will work. It is because C will assume all functions return int and takes int by default. It is the same reason you can pile and specify no libraries (just cc somefile.c). That will work because by default C will link with libc in /usr/lib or /lib. This (just cc somefile.c) may not work if you use any functions that is not in the standard library. A good example is sin(). 究竟入面有边d function系需要用到先要打上去? Not necessary. Many programmers (including myself) put in more than enough includes just in case. This will waste pile time but there are not harm done to the output. However
in a large or plex environment
you may have problem with this approach. It is a good habit of using the right amount of includes (or #define ...) in a source file. Under DOS/Windows environment
things are a bit different (such as location of the files) but the idea is the same.
yes
#include <呢个位系library> 即系话如果你要用果个library里面既function
就要系上面declare.. 如果你唔使用到既
就唔使declare...
参考: 我=.=v

已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式