Question: Write in Mac Terminal if possible. Write 2 functions, called scan_2 and print_2. Here are prototypes for each: void scan_2(int *i, char *c); // why
Write in Mac Terminal if possible.
-
Write 2 functions, called scan_2 and print_2. Here are prototypes for each: void scan_2(int *i, char *c); // why are pointers required?
void print_2(int i, char c); // why are pointers not required?
-
Write a function called pow_xy. The function should be passed 2 parameters, as illustrated in the prototype below.
int pow_xy(int *xptr, int y);
Assuming that xptr contains the address of variable x, pow_xy should compute x to the y power, and store the result as the new value of x. The function should also return the result.
-
Write a function called convert_temp. The prototype for this function is:
int convert_temp(int deg, char scale, int *dptr, char *sptr);
The function should convert a temperature from Fahrenheit to Celsius or vice versa, depending on the value of the parameter scale. The function should return an int reflecting whether or not the converted value *dptr is positive.
-
Write a function called init_array. It is passed 3 parameters, as specified in the prototype below:
int init_array(int array[ ], int len, int start_value);
The ith item in array should be initialized to the value start_value * i. Also, the function should return the sum of the values in array after initialization.
-
Write a function called reverse_numbers. The function is passed an array of ints (and of course its length as a 2nd parameter). The function should reverse the ordering of the numbers in the
array. Here is its prototype. You may assume that len >= 0. Note the return type of void.
void reverse_numbers(int nums[], int len);
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
