Programming in C Assignment, Quiz and Discussion
QUESTION 1
1. What’s the difference between an entry-condition loop and an exit-condition loop? Which kind is each of the C loops? Provide a detailed response with examples.
|
25 points
QUESTION 2
1. Write a for loop that prints the values 1 2 4 8 16 32 64 by increasing the value of a counting variable by a factor of two in each cycle.
|
25 points
QUESTION 3
1. Write a function that takes three arguments: a pointer to the first element of a range in an array, a pointer to the element following the end of a range in an array, and an int value. Have the function set each element of the array to the int value.
|
25 points
QUESTION 4
1. Write a void function called "swapPositive" which takes two reference parameters and swaps the values in those parameters if they are both positive numbers.
Show how this function is called from a main() program.
|