Question
Hello, Please help me answer the questions below using the C programming language. The first file is the only file that needs to be edited
Hello,
Please help me answer the questions below using the C programming language. The first file is the only file that needs to be edited and the second file performs various tests. The description of what each function must do is self-explanatory based on the name of the function.
Thank you!!
FILE #1
#include
//1
void scan_2(int *i, char *c) {
}
void print_2(int i, char c) {
}
//2
int pow_xy(int *xptr, int y) {
return result;
}
//3
int convert_temp(int degree, char scale, int *other_degree, char *other_scale) {
return 0;
}
//4
int init_array(int array[ ], int len, int start_value) {
return 0;
}
//5
void reverse_numbers(int nums[], int len) {
}
TEST FILE #2
#include
#include "FILE1.c"
void test_p1() {
printf(" p1 ");
int integer;
char character;
printf("type an int and a char (no blanks) ");
scan_2(&integer, &character);
print_2(integer, character);
}
void test_p2() {
printf(" p2 ");
int x = 2;
int *xptr = &x;
printf("pow_xy %d 3 ", x);
pow_xy(xptr, 3);
printf("= %d ", x);
}
void test_p3() {
printf(" p3 ");
int new_degrees;
char new_scale;
convert_temp(32, 'F', &new_degrees, &new_scale);
printf("32 F is %d %c ", new_degrees, new_scale);
convert_temp(10, 'C', &new_degrees, &new_scale);
printf("10 C is %d %c ", new_degrees, new_scale);
}
void test_p4() {
printf(" p4 ");
int numbers[5];
init_array(numbers, 5, 2);
int i;
for (i=0; i<5; i++)
printf("%d ", numbers[i]);
printf(" ");
}
void test_p5() {
printf(" p5 ");
int phone[] = {3, 1, 2, 3, 6, 2, 6, 1, 0, 6};
reverse_numbers(phone, 10);
int i;
for (i=0; i<10; i++)
printf("%d ", phone[i]);
printf(" ");
}
int main() {
test_p1();
test_p2();
test_p3();
test_p4();
test_p5();
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started