Monday, August 8, 2011

Chapter 2, exercise 2

1  : /* ex02 - 02.c */
2  : #include <stdio.h>
3  :
4  : void display_line(void);
5  :
6  : int main(void)
7  : {
8  :  display_line();
9  :  printf("\n Teach Yourself C In 21 Days!\n");
10 :   display_line();
11 :
12 :  return 0;
13 : }
14 :
15 : /* print asterisk line */
16 : void display_line(void)
17 : {
18 :   int counter;
19 :
20 :    for(counter=0;counter<30;counter++)
21 :      printf("*");
22 : }
23 : /* end of program */

a. What line(s) contain statements?

8, 9, 10, 12, 20-21.

b. What line(s) contain variable definitions?

18.


c.  What line(s) contain function prototypes?

4.

d.  What line(s) contain function definitions?

6-13, 16-22.

e.  What line(s) contain comments?

2, 15, 23.

No comments:

Post a Comment