Do some reading... A Tutorial on Pointers and Arrays in C ... it may help.Code:char numbers[13][] = {"Ace", "2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King"}; char suite[4][] = {"Clubs", "Diamonds", "Hearts", "Spades"};
What happens in the marked section above when i = 0?Code:for (i = 0; i < sum; i = i + 2) { fprintf(ofp, "%s of %s\n", numbers[input[i]], suite[input[i - 1]]); }
You are also opening files that you don't close...