So I'm trying to run a dice program where I'm playing with the computer.
So here it is .
Code:
#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<stdlib.h>
void main()
{
int dice,user,comp;
long *a;
srand(*a);
dice=abs(rand()%7);
printf("Enter User Guess:\n");
scanf("%d",&user);
user=abs(user%7);
comp=abs(rand()%6);
printf("Dice val:%d\nUser Guess:%d\nComputer Guess:%d\n", dic ,user,comp);
if(abs(dice-user)<abs(dice-comp))
printf("Winner: user");
else if(abs(dice-user)==abs(dice-comp))
printf("Winner: Computer");
else
printf("Its a draw");
getch();
}
So when I run I get an error then the program exits. What am I missing? I can't seem to see it. Thanks in Advance