Code:So i am creating two arrays a card and a corresponding suit i want to make it into an array that shows: {{A,S}{2,S},{3,S}...{A,C},{2,C}...}. The following is what I have so far. Any help would be great!
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <memory.h> int five(int player,int money){ int x,y,i,j; char deck_n[13][200],deck[13]; if ((player > 4)||(player < 2)){ printf("Players must be between 2-4. Please enter the right number"); } if (money <= 0){ printf("You must start with more then 0 dollars"); } srand(time( NULL )); x = rand()%13; y = rand()%4+1; const char *card[] = {"A","2","3","4","5","6","7","8","9","10","J","Q","K"}; const char *suit[] = {"S","C","D","H"}; //printf("%d,%d \n",x,y); //printf("%c%c \n",*card[x],*suit[y]); for(j = 0; j < 4;j++){ for(i = 0;i < 13;i++){ deck_n[i][j] = *card[i],*suit[j]; printf("%c \n",deck_n[i][j]); } } } main(){ five(2,100); }