"C-language learning", "C Primer Plus", chapter 2nd, C language overview

Source: Internet
Author: User
Tags function prototype

Learning Summary

1, #include是C预处理命令之一, #include指向的是头文件, such as # include <stdio.h>, this stdio.h is one of the C standard libraries that the program needs to reference. It contains printf, scanf and other functions. Java said: "This is not my bag." ”

2, C90 comments only */* comments */,c99 after the Add//.

3. The C90 declaration must be declared at the beginning of the code, and C99 can be declared before any used place, as in C + + and Java. In order to be compatible, the code begins to declare well.

4, C language standard main function: int main (int argc, char* argv[]) can also be without parameter int main ()/int main (void), int return value is to tell the operation of operating system function to exit normally (0 is normal)

5, function prototype, is a C file contains a number of functions used in a declaration, to tell the compiler in advance to use the function. Before the function is written in the main function, some compilers can compile without declaring a function prototype, but the C Standard recommends that you provide a function prototype for all functions.

Such as:

void printtime (void/*/int  main () {  ...  Printtime ();       /*  */  ...} void Printtime (void/*/  ...}

6, under Linux to perform C debugging can use the GDB command debugging tools, you can also simply use the Debug macro or printf function printing. Specific or personal habits. There's only one goal anyway: Improve code stability.

7, Programming exercises (title 7):

1#include <stdio.h>2 3 voidBoth (void);4 voidOne_three (void);5 6 intMainvoid){7printf"starting now:\n");8 One_three ();9printf"done!\n");Ten         return 0; One } A  - voidBoth (void){ -printf"two\n"); the } -  - voidOne_three (void){ -printf"on\n"); + both (); -printf"three\n"); +}

Operation Result:

Starting now:

On

Both

Three

done!

"C-language learning", "C Primer Plus", chapter 2nd, C language overview

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.