hi guys i'm doin this program to verify if there are consonants in a char matrix but i have this problem at line 24 |24|error: invalid types 'char[int]' for array subscript|
and this |14|error: expected primary-expression before 'char'| at line 14
can you help me thanks;
#include <iostream>
using namespace std;
void find_consonant(char *matrix, char vector[], int n, int m);
int main()
{cout<<"inserisci dimensioni";
int n, m;
cin>>n; cin>>m;
char matrix[n][m];
char vector[5]={'a','e','i','o','u'};
for (int i=0; i<n; i++)
{for(int j=0; j<m; j++)
cin>>matrix[i][j];
find_consonant(char &matrice[0][0], vector[5], n, m);
}
}
void find_consonant()(char *matrix, char vector[], int n, int m)
{
for (int i=0; i<n; i++)
{for(int j=0; j<m; j++)
{
for(int l=0; l<5; l++)
#include <iostream>
usingnamespace std;
void find_consonant ( char * matrix, char vector[], int n, int m );
int main ( )
{
cout << "inserisci dimensioni";
int n, m;
cin >> n >> m;
char matrix[n][m];
char vector[5] = {'a','e','i','o','u'};
for ( int i = 0; i < n; i++ )
{
for ( int j = 0; j < m; j++ )
cin >> matrix[i][j];
find_consonant ( char & matrice[0][0], vector[5], n, m );
}
}
void find_consonant ( char * matrix, char vector[], int n, int m )
{
for ( int i=0; i<n; i++ )
{
for ( int j = 0; j < m; j++ )
{
for ( int l = 0; l < 5; l++ )
if ( matrix[i][j] != vector[l] )
cout << "YES";
}
}
}
line 13: arrays cannot be dynamically created this way
line 21: Your function takes 'char * matrix', but you are trying to give it 'char & matrice[0][0]'
note: 'char * matrix' is the same as 'char matrix[]'
Is this for school or are you trying to learn how to code by yourself?