1. Engineering
  2. Computer Science
  3. please write a c code to do the following in...

Question: please write a c code to do the following in...

Question details

Please write a C code to do the following in Part 1, using the Shell Code provided:

HW1-2: The goal of this part of the project is to modify a short C program, compile it using the GNU C Compiler gcc, and run it. A program shell Hw1-2-shell.c is provided. You must copy/rename it to Hw1-2.c and modify it to compute the union of two integer sets, which are declared and initialized as the global variables setA and setB. Your program should print each element in the union (in any order). It should then print the number of elements in the union. Assume that the sets both hold exactly ten integers and that they are sets in that there are no Be sure to try multiple test cases, but do not change the declaration of the global variables (you should change only their initial values, such as the elements in the arrays to create new test cases). You should open a terminal window to run gcc under Linux/Unix (type man gcc for compiler usage or look up GCC online documentation on the intemet). If you do not have gcc ECE 2035 Homework installed, you can use sudo apt-get install gcc (see this article or this one for quick tutorials on apt-get and installing packages). Note that in the terminal window, you can enter any of the Linux commands (such as ls, cd, ср; for reference see http://ece2035ece gatech.edu assignments Linux Cmd Cheatsheet pdf Use the Linux command cd to change your current working directory to the directory in which you placed the shell program. For e > cd/Documents/2035/hwl

or > cd /mnt/c/users/Linda/2035/hwl You can list the files in that directory using 1s-la You can copy a file using cp or rename a file using mv (move a file to a new file). For example You can use any of the available text editors normally found on Linux, including vi, vim, and emacs. Using the text editor of your choice modify the HW1-2.c program to compute the span as described above. Once you write your program, you can compile and run it using the Linux command line >gcc H1-2.c -g -Wall -o HW1-2 > ./HW1-2 You should become familiar with the compiler options specified by these flags. In order for your solution to be properly received and graded, there are a few requirements. 1. The file must be named HW1-2.c 1. Your name and the date should be included in the header comment. 2. Do not #include any additional libraries. 3. In the starting shell program, it is especially important not to remove or modify any print statements since they will be used in the grading process. 4. Your solution must include proper documentation and appropriate indentation. 5. Your solution must be properly uploaded to Canvas before the scheduled due date.


Here is the Shell Code Provided :

/* ECE 2035 Homework 1-2

Your Name:

This is the only file that should be modified for the C implementation
of Homework 1.

This program computes and prints the union of two sets of
ten integers, SetA and SetB. It also prints the size of the union.


//DO NOT change the following declaration (you may change the initial value).
int SetA[] = {5, -19, 8, 26, 3, 6, -9, 17, 60, -63};
int SetB[] = {8, 11, -63, 18, 26, 17, 25, 12, -9, 60};
For the grading scripts to run correctly, the above declarations
must be the first lines of code in this file (for this homework
assignment only). Under penalty of grade point loss, do not change
these lines, except to replace the initial values while you are testing
your code.

Also, do not include any additional libraries.

int main() {
int Size;

// insert your code here
// print the i_th element of the union set using a print statement with this format:
// printf("%d: %d ", i, element);

printf("Union Set Size: %d ", Size);
return 0;


If you can send me the file itself, email pls.

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution