how do I set char a[j] = *char b[d]?
Hello everyone...
I've played around with my code from a previous posting (outputing spintf to array) to make things a bit easier to figure out.
I'm trying to populate one character array with data from a second that's constantly changing. In the case below, the array "char decktype" is what I'm trying to populate. The second array "char value" will be changing as it goes through the FOR loop.
But, it's not allowing me to do this. I'm running code blocks on a windows machine.
Does anyone have any suggestions? Thanks very much for any help!
Code:
#include <stdio.h>
#include <string.h>
main(){
int d, j;
d = 0;
char decktype[312]; // Controlled by int j - Will store type of card
char *value[13] = {"Ace", "Deuce", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King"}; //controlled by int d
for (j=0; j<=311; j++)
{
decktype[j]=*value[d];
d++;
if (d>12) {d=0} //Resets the card value to Ace after King has been assigned.
}