Question
Use the FinalStarter.c and fill in the missing functions: //your functions to implement //this function counts the number of even numbers in the list at
Use the FinalStarter.c and fill in the missing functions:
//your functions to implement
//this function counts the number of even numbers in the list at a given time
void countEven(int[], int size);
/*This function removes a number from the given position. You must pack the array from the bottom and return the new size. So, if one number is removed the size will decrement by 1 and so on.*/
int removeNum(int[], int position);
/*This function inserts the number, num, at the given position, and returns the new size. So, if the number 5 was added to the list, it would return the size incremented by 1*/
int insertNum(int[], int num, int position);
This is the missing program for part 2;
/*This program has a function that will generate a list of integers using the rand function.
Your job is to fill the implementation functions.*/
#include
#include
#include
//constants and function prototypes
const int CAP = 10;
void buildList(int[], int size);
void printList(int[], int size);
//your functions to implement
//this function counts the number of even numbers in the list at a given time
void countEven(int[], int size);
/*This function removes a number from the given position. You must pack the array from the bottom and return the new size. So, if
1 number is removed the size will decrement by 1 and so on.*/
int removeNum(int[], int position);
/*This function inserts the number, num, at the given position, and returns the new size. So, if the number 5 was added to the list, it would
return the size incremented by 1*/
int insertNum(int[], int num, int position);
int main()
{
//DO NOT CHANGE MAIN
int list[10], size = CAP;
buildList(list, size);
printList(list, size);
countEven(list, size);
size = removeNum(list, 4);
size = removeNum(list, 5);
printList(list, size);
size = insertNum(list, 10, 1);
size = insertNum(list, 18, 0);
printList(list, size);
return 0;
}
//function to build list. DO NOT CHANGE THIS
void buildList(int list[], int size)
{
srand(time(NULL));
for (int i = 0; i < size; i++)
{
list[i] = rand() % 100;
}
}
//function to print list. DO NOT CHANGE THIS
void printList(int list[], int size)
{
for (int i = 0; i < size; i++)
{
printf("%d ", list[i]);
}
}
//implement the missing functions here.
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