CSE271: Short Quiz #3 -- C Basics

  1. Write the function prototype (declaration) for a function called gear() that takes two int arguments and returns type int. (2 points)
  2. Write a function that returns the absolute value of the difference between two integers. (4 points)
  3. Explain what is wrong with the following seven line function (4 points):
    1   void salami(num)
    2   {
    3     int num, count;
    4
    5     for (count=1; count <= num; num++)
    6        printf("A wonderful sandwich!\n");
    7   }
    


Last revised: 1 February 2007, Brian D. Davison.