tried it . now whever the options are displayed the "straight" always appears as one even if the input wasnt a straight

what am i doing wrong?

also right at the end there is a getchar to read the final input but it never allows me to do so and just ends the program?:S:S

Code:

#define FREQ 7
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
int VALUES = 0;
int dice[VALUES];
int freq[FREQ];
int x = 0;
int p = 0;
int c;
int sum = 0;
int choice = 0;
int d = 0;
int triple = 0;
int four = 0;
int yahtzee = 0;
int sort[5];
int right_side = 0;
int s_straight = 0;
int straight = 0;
int count = 0;
int d_total = 0;
int score[count];
int temp;
int a, b;
int c_last;
printf("Please enter dice values: \n> ");
c = getchar();
while (c != 10) {
if (isdigit(c)) {
dice[x] = c - 48;
x = x + 1;
}
c = getchar();
}
VALUES = x;
for (x = 0; x < VALUES; x++) {
if (dice[x] < 1 || dice[x] > 6) {
printf("\nValue Out of Range.\n");
exit(1);
}
}
for (x = 0; x < FREQ; x++) {
freq[x] = 0;
}
for (x = 0; x < VALUES; x++) {
p = 0;
p = dice[x];
freq[p] += 1;
}
for (x = 1; x < FREQ; x++) {
sum += freq[x];
}
if (sum < 1 || sum > 6) {
printf("\nIncorrect number of values.\n");
exit(1);
}
printf("\nYour dice values are: ");
for (x = 0; x < 5; x++) {
printf(" %d", dice[x]);
}
printf
("\n\nPlease choose:\n1 -> Reroll some dice\n2 -> Reroll all dice\n3 -> Keep dice\n");
choice = getchar();
while (c != 10) {
if (choice - 48 < 1 || choice - 48 > 3) {
printf("\nInvalid Choice.\n");
exit(1);
} else {
printf("\n");
}
}
for (x = 0; x < 5; x++) {
d_total = d_total + dice[x];
}
for (x = 1; x < FREQ; x++) {
if (freq[x] == 2) {
d = 1;
break;
}
}
for (x = 1; x < FREQ; x++) {
if (freq[x] == 3) {
triple = 1;
break;
}
}
for (x = 1; x < FREQ; x++) {
if (freq[x] == 4) {
four = 1;
break;
}
}
for (x = 1; x < FREQ; x++) {
if (freq[x] == 5) {
yahtzee = 1;
break;
}
}
for (x = 0; x < 5; x++) {
sort[x] = dice[x];
}
for (a = 0; a < 4; a++)
for (b = a + 1; b < 5; b++)
if (sort[a] > sort[b]) {
temp = sort[b];
sort[b] = sort[a];
sort[a] = temp;
}
for (x = 1; x < 5; x++) {
if (dice[x - 1] > dice[x]) {
if (x > 1) {
break;
} else {
right_side = 1;
}
}
}
if (x == 5) {
if (right_side == 1) {
s_straight = 1;
} else {
straight = 1;
}
}
if (choice == 51) {
printf("\nYour score options are:");
}
if (triple == 1) {
count = count + 1;
score[count] = d_total;
printf("\n%d -> Three of a Kind ( %d points)", count,
score[count]);
}
if (four == 1) {
count = count + 1;
score[count] = d_total;
printf("\n %d -> Four of a Kind ( %d points)", count,
score[count]);
}
if ((d == 1) && (triple == 1)) {
count = count + 1;
score[count] = 25;
printf("\n %d -> Full House ( %d points)", count, score[count]);
}
if (s_straight == 1) {
count = count + 1;
score[count] = 30;
printf("\n %d -> Small Straight ( %d points)", count,
score[count]);
}
if (straight == 1) {
count = count + 1;
score[count] = 40;
printf("\n %d -> Straight ( %d points)", count, score[count]);
}
if (yahtzee == 1) {
count = count + 1;
score[count] = 50;
printf("\n %d -> Yahtzee ( %d points)", count, score[count]);
}
{
count = count + 1;
score[count] = d_total;
printf("\n %d -> Chance ( %d points)", count, score[count]);
}
c_last = getchar();
while (c_last != 10) {
if (choice - 48 > 0 || choice - 48 < count) {
printf("\n>Your score is: %d points\n", score[choice - 48]);
}
}
return (0);
}