hey guys i need a little help here, I am trying to write a program that prints a 2d array to the screen and then compares each row and column to see if there is any pairs of letters. basically something that looks like this:
---------------------------
V T A Y U C B
D F W Q Q C R
D A L Y M F G
O A S S D T I
Number of horizontal pairs: 2
Number of vertical pairs: 3
---------------------------
so far this is my code below, but i dont know how to approach the comparisons .. please help!
Code:
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
int main( void )
{
int x = 0;
int y = 0;
int countX = 0;
int countY = 0;
srandom( (unsigned) time(NULL) );
char array[x][y];
for (x=0;x<20;x++)
{
for (y=0; y<30; y++)
{
array[x][y] = random() % 26 + 65;
printf("%c ",array[x][y]);
}
printf("\n");
}
printf ("\n\n");
return ( 0 ) ;
}