So I have this program, I have to compare the rows based on the number of consonants,i made an array char voc[12] where I've put all the vocals, then I tried to make a function that calculates the total number of vocals and consonants, but it as well doesn't work.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
int main()
{
srand(time(NULL));
char rand_string[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
char voc[12] = {'a','e','i','o','u','A','E','I','O','U','Y','y','\0'};
int m,n,i,j,elem=0,vocale=0;
printf("Introduceti numarul de linii si coloane:");
scanf("%d %d", &m, &n);
char a[m][n];
for (i=0; i<m; i++)
{
for(j=0; j<n; j++)
{
a[i][j]=rand_string[rand() % (sizeof(rand_string) - 1)];
}
}
printf("Matrita e:\n");
for (i=0; i<m; i++)
{
printf(" \n ");
for(j=0; j<n; j++)
{
printf(" %c\t ", a[i][j]);
}
}
for ( i = 0; a[i][j] != '\0'; i++)
{
for (j = 0; a[i][j] != '\0'; j++)
{
if(a[i][j] == voc[i])
{
vocale++;
}
else
{
elem++;
}
}
printf("\n %d ", vocale);
printf("\n %d ", elem);
}
return 0;
}