Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint

Exercises

1.Define a type FunctionPtr (using typedef) that represents a pointer to a function that returns an int and that takes no arguments. Refer to Chapter 11, “Pointers,” for the details on how to declare a variable of this type.
2.Write a function called monthName that takes as its argument a value of type enum month (as defined in this chapter) and returns a pointer to a character string containing the name of the month. In this way, you can display the value of an enum month variable with a statement such as:
printf ("%s\n", monthName (aMonth));

3.Given the following variable declarations:
float     f = 1.00;
short int i = 100;
long int  l = 500L;
double    d = 15.00;

and the seven steps outlined in this chapter for conversion of operands in expressions, determine the type and value of the following expressions:

f + i
l / d
i / l + f
l * i
f / 2
i / (d + f)
l / (i * 2.0)
l + i / (double) l

 


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial