# Rotate the Grid

I’m not immersed in higher mathematics, therefore most of my programming puzzles tend to involve strings or other items I can easily comprehend. Beyond manipulating characters and strings, for my programming kung fu training I keep returning to the matrix or grid.

A grid is a two-dimensional array in C, a set of rows and columns defined as:

`int grid[8][8];`

The two dimensions are specified in brackets after the data type and variable name. They need not be equal, though in my mind equal dimensions define the difference between a grid/matrix and what I’d call a table.

The two-dimensional, double-bracket notation is merely for your reference. Internally, the grid’s data is stored in a linear fashion. So the same array can be declared as:

`int grid[64];`

To establish `grid[]` as a matrix and not a single file parade of 64 integers, you code the overhead, ensuring that data is manipulated and output in tidy rows and columns.

For this month’s Exercise, your task is to create a two character grids of the same size, 5-by-5. The first grid is to be initialized randomly, filled with characters ranging from `'a'` to `'z'`. The second grid contains the same characters as the first, but it’s rotated 90 degrees clockwise. To wit:

```Original:  j x y i r  e n y f h  i o o i h  i d k l u  g x c q b Rotated:  g i i e j  x d o n x  c k o y y  q l i f i  b u h h r ```