#include <stdio.h>

//int rows, cols;

//void matcher(char arr[][7], int rows, int cols);


//*****VIKTIGT****** //It is only possible to call a function containing
// an array if the second and subsequent dimensions are given!!// This could also be achieved with pointers.
void matcher(char arr[][7], int x, int y){
	int nhemma = 0;
	int nborta = 0;
	int noav = 0;
	int i,j;
	for (i =0; i < x; i++) //nested for loop to traverse array
	  {		
	    nhemma=0;
	    nborta=0;
	    noav=0;    //reset counter variables after each row
		for (j=0; j< y; j++)
		  {
		    if (arr[i][j]== '1')
		      {
			nhemma++; //increment counter for each true condition
		      }
		    else if (arr[i][j]== '2')
		      {
			nborta++;
		      }
		    else 
		      {
			noav++;
		      }
		  }
		printf("Omgang %i\nHemma: %i\nBorta: %i\nOavgjort: %i\n\n", i+1, nhemma, nborta, noav);		
	  }
}		



void main(){

  char resultat_arr[10][7] = {{'1','x','2','1','x','2','2'},
			      {'1','x','2','1','x','2','2'},
			      {'1','x','2','1','x','2','2'},
			      {'1','x','2','1','x','1','1'},
			      {'1','x','2','1','x','2','2'},
			      {'2','x','1','2','1','x','x'},
			      {'2','x','1','2','1','x','x'},
			      {'x','x','x','x','x','x','x'},
			      {'2','x','1','2','1','x','x'},
			      {'2','x','1','2','1','x','x'}};
  
  matcher(resultat_arr, 10, 7);
}









