找回密码
 注册
搜索
热搜: java php web
查看: 404|回复: 4

[C] C Programming Q & A - 01

[复制链接]
发表于 2009-6-14 18:14:53 | 显示全部楼层 |阅读模式
Just want to share some common C programming questions and answers here, if anyone has a better answer or comments, please feel free to reply, in either Chinese or English.  Hope everyone can learn from each other and share knowledge.


What is the difference between #include <file> and #include “file”?

Answers:
When writing your C program, you can include files in two ways. The first way is to surround the file you want to include with the angled brackets < and >. This method of inclusion tells the preprocessor to look for the file in the predefined default location. This predefined default location is often an INCLUDE environment variable that denotes the path to your include files. For instance, given the INCLUDE variable

INCLUDE=C:COMPILERINCLUDE;S:SOURCEHEADERS;

using the #include <file> version of file inclusion, the compiler first checks the C:COMPILERINCLUDE
directory for the specified file. If the file is not found there, the compiler then checks the
S:SOURCEHEADERS directory. If the file is still not found, the preprocessor checks the current directory.

The second way to include files is to surround the file you want to include with double quotation marks " ". This method of inclusion tells the preprocessor to look for the file in the current directory first, then look for it in the predefined locations you have set up. Using the #include “file” version of file inclusion and applying it to the preceding example, the preprocessor first checks the current directory for the specified file. If the file is not found in the current directory, the C:COMPILERINCLUDE directory is searched. If the file is still not found, the preprocessor checks the S:SOURCEHEADERS directory.

The #include <file> method of file inclusion is often used to include standard headers such as stdio.h or
stdlib.h. This is because these headers are rarely (if ever) modified, and they should always be read from your compiler’s standard include file directory.

The #include “file” method of file inclusion is often used to include nonstandard header files that you have created for use in your program. This is because these headers are often modified in the current directory, and you will want the preprocessor to use your newly modified version of the header rather than the older, unmodified version.
发表于 2009-6-17 13:27:24 | 显示全部楼层
支持,虽然不能完全看懂,大概了解
回复

使用道具 举报

发表于 2009-6-26 19:22:58 | 显示全部楼层
我是编程盲啊,谁教教我 QQ727781765
回复

使用道具 举报

发表于 2009-9-7 09:51:10 | 显示全部楼层
基础的东西总是错的最多的
回复

使用道具 举报

发表于 2009-12-31 00:50:54 | 显示全部楼层
完全是赚分贴,自己发题目自己已经给答案了
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|软晨网(RuanChen.com)

GMT+8, 2024-11-22 18:05

Powered by Discuz! X3.5

Copyright © 2001-2023 Tencent Cloud.

快速回复 返回顶部 返回列表