2. (100 pts) Write a C program E2p2.c that accepts three command line arguments n,M,N where n is an integer between 2 an

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

2. (100 pts) Write a C program E2p2.c that accepts three command line arguments n,M,N where n is an integer between 2 an

Post by answerhappygod »

2 100 Pts Write A C Program E2p2 C That Accepts Three Command Line Arguments N M N Where N Is An Integer Between 2 An 1
2 100 Pts Write A C Program E2p2 C That Accepts Three Command Line Arguments N M N Where N Is An Integer Between 2 An 1 (159.45 KiB) Viewed 29 times
2 100 Pts Write A C Program E2p2 C That Accepts Three Command Line Arguments N M N Where N Is An Integer Between 2 An 2
2 100 Pts Write A C Program E2p2 C That Accepts Three Command Line Arguments N M N Where N Is An Integer Between 2 An 2 (28.53 KiB) Viewed 29 times
Note: if you don’t use pthreads to accomplish the requestedtask, you will get zero points.
2. (100 pts) Write a C program E2p2.c that accepts three command line arguments n,M,N where n is an integer between 2 and 4 inclusive, M is an integral multiple of 24 (e.g. 24, 48, etc), and N is an integer between 5 and 15 inclusive. Generate M*N random integers between 1 and 79 inclusive and store them in an M by N 2D dynamic integer array. The program should use pthread to create n threads to backward-reverse-copy all the array elements in place (i.e. the first row and last row are swapped in reverse column order, the second row and second-to-last row are swapped in reverse column order, etc). The program should divide this task of backward-reverse-copying the array elements among the created n threads as evenly as possible. The program should print all the array elements before and after the update. A sample run can look like the following: [kwang@computer] [~/temp]$./E2p2 4 24 6 Using 4 threads. Original array: 48,78,14,76,76,50 34,21,54,64,62,47 ...(additional 20 rows here!!!!!!!!) 56,41,17,25,4,54 26,4,56,13,53,28
Backward-reverse-copy of the original array: 28,53,13,56,4,26 54,4,25,17,41,56 ...(additional 20 rows here!!!!!!!) 47,62,64,54,21,34 50,76,76,14,78,48
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply