Thư viện tri thức trực tuyến
Kho tài liệu với 50,000+ tài liệu học thuật
© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

C Programming for the Absolute Beginner phần 2 ppsx
Nội dung xem thử
Mô tả chi tiết
A simple correction to the comment block, shown next, will solve the issue and allow the
program to compile successfully.
/* This corrects the previous comment block error */
SUMMARY
• Functions allow you to group a logical series of activities, or program statements, under
one name.
• Functions can take in and pass back information.
• An algorithm is a finite step-by-step process for solving a problem.
• Each function implementation requires that you use a beginning brace ({) and a closing
brace (}).
• Comments help to identify program purpose and explain complex routines.
• The character set /* signifies the beginning of a comment block and the character set
*/ identifies the end of a comment block.
• There are 32 words defined as keywords in the standard ANSI C programming language;
these keywords have predefined uses and cannot be used for any other purpose in a C
program.
• Most program statements control program execution and functionality and may require
a program statement terminator (;).
• Program statements that do not require a terminator include preprocessor directives,
comment blocks, and function headers.
• The printf() function is used to display output to the computer screen.
• When combined with the backslash (\), special characters such as n make up an escape
sequence.
• The library name stdio.h is short for standard input output and contains links to various
standard C library functions, such as printf().
• C compilers such as gcc preprocess program code, generate error codes and messages if
applicable, compile program code into object code, and link any necessary libraries.
• Compile errors are generally the result of syntax issues, including missing identifiers
and terminators, or invalid directives, escape sequences, and comment blocks.
• A single error at the top of your program can cause cascading errors during compile
time.
• The best place to start debugging compile errors is with the first error.
24 C Programming for the Absolute Beginner, Second Edition
Challenges
1. Study the VIM Quick Guide as described in Appendix B.
2. Study the nano Quick Guide as described in Appendix C.
3. Create a program that prints your name.
4. Create a program that uses escape sequence \" to print your
favorite quote.
5. Create a program that uses escape sequence \\ to print the following directory structure: c:\cygwin\home\administrator.
6. Write a program that prints a diamond as demonstrated next.
*
* *
* *
* *
* *
* *
*
7. Create a calendar program using the current month (similar to
the one shown in Figure 1.6).
Chapter 1 • Getting Started with C Programming 25