原创 FAQs of my own about C under VS2005

2008-8-23 15:19 1569 2 2 分类: 软件与OS

C, Data Structure learning......


It may be a laugh doing this after my graduation. But please don't.


Build a FAQ to record my learning.


1: How to establish a project in VS2005( c/c++ project:


File->New->Project->Visual C++->Win32->Win32 Console Application( enter name, select location )->Press OK->Console Application, Empty Project->OK. Then the project is established. You can add your own C/CPP source file then.


2: How to add source file and header file to project:


Add source file: ritht click on Source Files->Add->New Item( establish a new file and add ), Existing Files( add existing files ).


To add Header Files are the same.


3: How to establish a Header File under VS2005 compiler ? 


It 's a problem for me. I am studying it. Is there a C/C++ master who will share it with me? It would be very thankful.


  1): What's the use of #ifndef/#define/#endif in the header files's start ?


  2): How to inlude header files in a file ? What's the difference between " " and < > when include a header file?


    Header files can be included in another header file or in a source code file. One way to include a header file is to use absolute include path or relative include path. But what's the use of Header Files collection in the Project Solution Explorer?


   I only know that one is used to include standard header files and another for user own header files. (2008.08.22 )


    Both " " and < > can be used to include any header files. But they have different meanings. " " means that the compiler will search the user's defined including directory first to locate the header file, while < > means that the compiler will search the system directory first. To use the " " and  < > correctly will speed the process of compiling.


4: What's the use of the Header Files stdio.h and conio.h ? What's the use of the funcion void *malloc(  unsigned int ) and void *realloc(void *mem_address, unsigned int newsize) ? How to use them?


    Stdio is the short of Standard Input and Output, conio is the short of Console Input and Output. Both provides some declaration about Input and Output Functions. Such as getch(), putch(), scanf(), printf() in stdio.h. In some conditons, getch() is declard in conio.h, too.


   In most conditons, stdio.h is enough. ( very simple answer, maybe answered better now after ).


5: What's the working principles about C ? such as: the definition, the reference, the inlcude, etc. This will be a problem puzzling me for a long time. There are so many knowledges to learn. Maybe K&R can tell me the answer.

PARTNER CONTENT

文章评论0条评论)

登录后参与讨论
我要评论
0
2
关闭 站长推荐上一条 /3 下一条