049_rot_matrix
Folders and files
Name | Name | Last commit date | ||
---|---|---|---|---|
parent directory.. | ||||
For this problem, you will be writing a program which performs a 90 degree clockwise rotation of a 10x10 matrix. There is nothing special about a 10x10 matrix---I just need to fix the matrix size, since we have not learned about dynamic memory allocation yet, so we do not have the knowledge needed to read in any size of matrix. To keep the input processing simple, the matrix will be a matrix of characters (so you will have something like char matrix[10][10] in your program), which will be read from a file. Each line in the input file should contain 10 characters (plus a newline). Requirements: ============= - Create a file called rotateMatrix.c - Your program will take one command line argument, a string specifying the input file to read. - The input file should contain 10 lines, each of which have 10 (non-newline) characters (plus a newline). - Your program should then rotate this 90 degrees clockwise, and print the result on stdout. Note that sample.txt provides sample input, and sample.out provides sample output. - If there are any errors, your program should print an appropriate message to stderr, and exit with EXIT_FAILURE. Hints: ------ - You may find the strchr useful for error checking that you read a proper line (10 non-newline characters, then a newline).