samedi 13 juin 2015

Error assigning random number to int using rand()

I have looked all over for an answer and everywhere I have checked confirms this code should be working, so what am I missing? I want to assign random numbers to two different variables. I've commented off the errors I'm getting in my IDE. (Note: this isnt the full code, just the relevant section)

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main(void){

int k; seed; mines; row; column;
printf("Please enter your seed: ");
scanf("%d", &seed); getchar();
srand(seed);
for(k = 1; k <= mines; k++) {
    row = rand() % 8;                 //error:called object type int is not a function or function pointer
    column = rand() % 8;              //error:called object type int is not a function or function pointer
    if(board[row][column] == 0) {
        board[row][column] = boom;

    }
}
}




Aucun commentaire:

Enregistrer un commentaire