Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Do NOT modify main function at all #include #include #include #define ARRAY_SIZE 20 // do NOT touch void rotateArray(char *ptr, int n) { } /*********************************/

image text in transcribedDo NOT modify main function at all

#include  #include  #include  #define ARRAY_SIZE 20 // do NOT touch void rotateArray(char *ptr, int n) { } /*********************************/ // Do NOT touch anything below this line int main(int argc, char **argv){ FILE *fp; int i = 0, j, n; char c; char arr[20][20]; fp = fopen(argv[1], "r"); n = atoi(argv[2]); do{ c = (char)fgetc(fp); if(isprint(c) != 0){ arr[i/ARRAY_SIZE][i%ARRAY_SIZE] = c; i++; } } while(c != EOF); printf("========INPUT======= "); for(i = 0; i   lab2.c skeleton file is created for you. Write a function that rotates an array. The signature of the function is: voidrotateArray(char*ptr,intn) You would need to implement a function that rotates this array by an angle specified by the command line argument. Let's assume a small example that is 44. The file contains the following contents. >> cat input.txt XXXX XXXX PPPP PPPP Here is the output of running the input file through your program. >>. /rotate intput. txt 90 PPXX PPXX PPXX PPXX Detailed specifications are below. 1. The command line argument is in this order input_file angle 2. I am supplying with one input file, but you are supposed to come up with your own input file as well to test your code 3. Angle will be multiples of 90 . The value can be positive, 0 , or negative. Positive means clockwise rotation whereas negative means counter-clockwise rotation. 4. You will implement rotateArray function 5. Your implementation in rotateArray function should NOT include any printf statement 6. Your input array size is guaranteed to be 20 by 20 . This will be the size of the arr in the file and the number of characters being passed by the input file 7. There will not be any corner case testing, meaning assume that the input file will always contain valid number of characters 8. Only alphanumeric characters and symbols on English keyboard will be used in the input file

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Informix Database Administrators Survival Guide

Authors: Joe Lumbley

1st Edition

0131243144, 978-0131243149

More Books

Students also viewed these Databases questions

Question

What is meant by 'Wealth Maximization ' ?

Answered: 1 week ago

Question

Describe the types of power that effective leaders employ

Answered: 1 week ago

Question

Describe how leadership styles should be adapted to the situation

Answered: 1 week ago