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