I'm trying to learn C Language using pointers and arrays etc... but my code won't work. Whats is wrong with this code?
#include <stdio.h>
#include <conio.h>
#include <windows.h>
#include <stdlib.h>
#include <time.h>
int main(){
int *number = 0;
int i = 0;
int *random = 0;
int randomTry[100];
int *getRandomTry = 0;
int randomGenerator[100];
int *getRandomGenerator = 0;
srand (time(NULL));
*getRandomTry = randomTry[100];
*getRandomGenerator = randomGenerator[100];
do{
*random = rand() % 10;
getRandomGenerator = random;
printf("Choosing a number:\n\r");
for(i = 0; i < 30; i++){
printf("*");
Sleep(50);
}
printf("\n\r\n\rWell done, your time.");
printf("\n\r------------------------------");
printf("\n\rPick a number ( 0 to 10): ");
scanf("%d", number);
getRandomTry = number;
if(*number > 10){
printf("\n\rRemember, number only from (0 to 10)\n\r");
}
else{
if(number == random){
printf("\n\rYou choose right!");
printf("You entered theses numbers till the right answer");
for(i = 0; i < randomTry[i]; i++){
printf("%i", getRandomTry);
}
}
else{
printf("\n\rYou choose wrong, number: %d - random: %d\n\r", number, random);
Sleep(700);
system("cls");
}
}
}while(number != random);
getch();
return 0;
}
When i compile the program stop working, no warnings or comments show in console.
I'm using the notepad++ with MinGw to compile this code.