I am completely new in C and try to fill a vector with random integers and output it afterwards. However, it seems that the vector is always filled with the same number. What do I need to change to really get random payments? There is no limit, the number should only be within the value range of long. Here's my code:
    #include "stdafx.h"
    #include <stdlib.h>
    #include <stdio.h>
    #include <vector>
    #include <time.h>
int main()
{
    long x = 20;
    long y = 12;
    std::vector<long> entries;
    //initialize simple random number generator using current time
    srand(time(NULL));
    for (int step = 0; step < x; step++) {      
        entries.push_back(rand());
        ++entries[step];
    }
    for (std::vector<long>::const_iterator i = entries.begin(); i != entries.end(); ++i) {
        printf("%ld\n", i);
    }       
    return 0;
}
EDIT: I want to solve the issue using plain C not c++!
 
     
    