Ho provato a creare il programma per mischiare le carte e distribuirle
Soltanto che mi crea un errore di segmentazione che non riesco a capire
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define EXIT_SUCCESS
#define FACES 13
#define SUITS 4
#define CARDS 52
void mescola(unsigned int wDeck[][FACES]);
void distribuire(unsigned int wDeck[][FACES],const char *suits[],const char *faces[]);
int main(void)
{
const char *suits[SUITS] = {"Cuori","Quadri","Picche","Bastoni"};
const char *faces[FACES] = {"Asse","Due","Tre","Quattro","Cinque","Sei","Sette","Otto","Nove","Dieci","Jack","Donna","Re"};
unsigned int deck[SUITS][FACES] = { { 0 } };
srand(time(NULL));
mescola(deck);
distribuire(deck,suits,faces);
return EXIT_SUCCESS;
}
void mescola(unsigned int wDeck[][FACES])
{
size_t x,row,column;
for (x = 0;x < CARDS ; ++x)
{
do
{
row = rand() % 4;
column = rand() % 13;
}while(wDeck[row][column] != 0);
wDeck[row][column] = x;
}
}
void distribuire(unsigned int wDeck[][FACES],const char *suits[],const char *faces[])
{
size_t card,row,column;
for (card = 0;card < CARDS;++card)
{
for (row = 0;row < SUITS;row++)
{
for (column = 0;column < FACES;column++)
{
if (wDeck[row][column] == card)
{
printf("%8s of %-9s",*faces[column],*suits[row]);
}
}
}
}
}