Невозможно преобразовать char * в char

Мои функции закомментированы, потому что я пытался сначала решить эту проблему><, Но когда я пытаюсь передать свои массивы в функции, компиляция выдает сообщение об ошибке.

error: cannot convert ‘char*’ to ‘char (*)[7][49]’ for argument ‘1’ to
‘void save(char (*)[7][49])’

Это происходит в моем коде в строках 63:61, 67:46 и 70:36.

//Header
#include <iostream>
#include <fstream>
using namespace std;

//function prototype
/*
Name: deal
Process: takes cards from file into 3d array and 2d array
Input: array name (int),2d array name (int)
Output: none
Dependencies: none
*/
void deal ( char tablue [7][7][49] , char wastePile [24][24]);
/*
Name: displayCards
Process: Displays cards from array to screen
Input: tablue array (char)
Output to screen: The cards in a solitaire display
Dependencies: None
*/
void displayCards ( char tabalue [7][7][49]);

/*
Name: save
Process: Save tablue to a file
Input: tablue (char)
Output: None
Depnencies: None
*/
void save ( char tablaue [7][7][49] );

// global constants
ofstream fout;
ifstream fin;

//main program
int main()
{
//initialize variables
bool menu = true;
char choice;
char tablaue [7][7][49], wastePile [24][24];

//switch menu
// display options
cout<< "G.ame" << endl << "Q.uit" << endl;

//menu
while ( menu == true )
{
// get user choice
cin >> choice;
// switch
switch (choice)
{
// if game
case 'G':

//get cards from file
//deal cards to three "deminsion array" and into waste pile
// function deal
deal ( &tablaue [7][7][49], &wastePile [24][24]);

//display cards on screen
// function displayCards
displayCards ( &tablaue [7][7][49]);

//save tablaue
save ( &tablaue [7][7][49]);

// pause screen
//system pause

// break case
break;

//if quit
case 'Q':

// end switch
menu = false;

//break case
break;
}
}
// display exit screen
cout<< "Thanks for playing";

//end program
return 0;
}

//Functions
void deal (char tablue [7][7][49], char wastePile [24][24])
{
/*/ initialize variables
char card [40];
char space [10];
int rowI, colI, cardI;

// open file
fin.open("card1.txt");

// prime loop
fin << card;

//take in cards
while (fin.good())
{
fin << SPACE;
// fill in array
for ( rowI=0, rowI<7, rowI++)
{
for ( colI=0, colI<7, colI++)
{
for ( cardI=0, cardI<49, cardI++)
{
// check to see if slot should be empty
if ( rowI < colI)
{
tablue[rowI][colI][cardI] = "EMPTY";
}
// put card in slot
else
{
tablue[rowI][colI][cardI] = card;
}
}
}

}
//fill waste pile
for (rowI=0, rowI<24, rowI++)
{
wastePile [rowI] = card;
}
}*/
}
void displayCards ( char tablue[7][7][49])
{
/*/ initialize variables
int rowI, colI, cardI;

// make space
cout<< endl << endl << "       ";

// display card
for (rowI =0, rowI<7, rowI++)
{
for (colI=0, colI<7, colI++)
{
for (cardI=0, cardI<7, cardI++)
{
//check for empty slot
if ( tablue[rowI][colI][cardI] != "EMPTY")
{
cout << tablue [rowI][colI][cardI];
}
else
{
cout<< "             ";
}
//print space
cout<<"       ";
}
}
}*/
}

void save ( char tablue [7][7][49] )
{
/*

*/
}

-3

Решение

Вам не нужно & или размер массива при передаче массива в качестве параметра. Достаточно просто ввести имя, при условии, что размер и тип базового массива объявлены правильно, как это может показаться из приведенного выше кода.

IE:

deal ( tablaue, wastePile );
5

Другие решения

Других решений пока нет …