Question: COP 2220 (Answer in C, not C++) 1a. Declare a structure whose tag name is Emp and that contains these fields (in the following order):
COP 2220 (Answer in C, not C++)
1a. Declare a structure whose tag name is Emp and that contains these fields (in the following order): adouble field named d, a character pointer named str, and an array of eleven integers named arr. In addition, declare a array named emp of 30 of these structures. Assign the value 12 to the lastelement of the arr field of the last element of emp. Assign 3.5 to the d field of the first emp element . Assign the string Hello to the k'th element of emp (assume k has been declared as an integer variable and assigned a value in the range of the array elements ).
1b. Write the definition of a function, isReverse, whose first two parameters are arrays of integers ofequal size, and whose third parameter is an integer indicating the size of each array . The function returns true if and only if one array is the reverse of the other. ("Reverse" here means same elements but in reverse order.)
1c. Write the definition of a function reverse, whose first parameter is an array of integers and whose second parameter is the number of elements in the array . The function reverses the elements of thearray . The function does not return a value .
1d.
Reversing the elements of an array involves swapping the corresponding elements of the array : the first with the last, the second with the next to the last, and so on, all the way to the middle of the array .
Given an array a, an int variable n containing the number of elements in a, and two other int variables , k and temp, write a loop that reverses the elements of the array .
Do not use any other variables besides a, n, k, and temp.
1f. You are given an int variable k, an int array zipcodeList that has been declared and initialized , anint variable nZips that contains the number of elements in zipcodeList, and an int variable duplicates.
Write some code that assigns 1 to duplicates if there are two adjacent elements in the array that have the same value , and that assigns 0 to duplicates otherwise. Use only k, zipcodeList, nZips, andduplicates.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
