I'm trying to get to allocate a specific number of memory with malloc, however when I run my program it gives some random letter output, and I can't see whats the matter with it. This is the first time I experiment with malloc, so hope you can understand.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define ACE 1
#define CardSize 52
void count();
int main()
{
    count();
    return 0;
}
void count() {
    int *cards;
    int i;
    cards = (int *)malloc(CardSize*sizeof(int));
    for (i = 0; i < 4; i++) {
        for (i = 1; i < 14; i++) {
            printf("%d\n", cards[i]);
        }
    }
}
Basically it should print out 1-13 in my array of cards[52] the cards, 4 different times. I don't understand why it won't do this, hope someone could help me out.
 
     
     
     
     
    