#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void initDeck (int deck[]);
void showDeck (int deck[]);
void shuffleDeck (int deck[]);
int getBet ();
main()
{
int deck[52];
int playerBet;
char z;
initDeck(deck);
shuffleDeck(deck);
showDeck(deck);
playerBet = getBet();
//scanf ("%d\n", &playerBet);
printf("%d\n", playerBet);
z = 1;
getchar(z);
return 0;
}
void initDeck (int deck[]){
int k;
int i;
for (k = 1; k < 53; k++){
i = k - 1;
deck[i] = k;
}
return;
}
void showDeck (int deck[]){
int k;
for (k = 0; k < 52; k++){
printf("%d\n", deck[k]);
}
return;
}
void shuffleDeck (int deck[]){
int random;
int k;
int temp;
srand(time(0));
for (k = 52; k > 1; k--){
random = (rand() % k) + 1;
if (random != k){
temp = deck[k - 1];
deck[k - 1] = deck[random - 1];
deck[random- 1] = temp;
}
else{
k++;
continue;
}
}
return;
}
int getBet (){
int bet;
scanf ("%d\n", &bet);
return bet;
}
The function at issue is getBet() and when I input an integer it doesn't give me any output. I tried doing the input in main and it worked, but I don't see the problem with this. I've double checked for small errors a few times, and I don't see anything wrong with it...