First, indent, so your code is readable.
Code:
#include <stdlib.h>
int main(void)
{
int sayi, mayin, i, x, y, a, b;
int tarla[15][30];
printf("Enter N (number of mines): ");
scanf("%d", &mayin);
tarla[a][b] = 0;
for (sayi = 0; sayi < mayin; sayi++) {
srand(time(0));
do {
x = 1 + rand() % 16;
y = 1 + rand() % 31;
}
while (tarla[x][y] == i);
tarla[x][y] = i;
}
for (x = 0; x < 15; x++) {
for (y = 0; y < 30; y++) {
if (tarla[x][y] == i)
printf("X");
else
printf("o");
printf("");
}
printf("\n");
}
return 0;
}
See SourceForge.net: Indentation - cpwiki
Second, enable as many warnings as you can for your compiler,
Code:
$ gcc -W -Wall -ansi -pedantic -O2 foo.c
foo.c: In function ‘main’:
foo.c:8: warning: implicit declaration of function ‘printf’
foo.c:8: warning: incompatible implicit declaration of built-in function ‘printf’
foo.c:9: warning: implicit declaration of function ‘scanf’
foo.c:9: warning: incompatible implicit declaration of built-in function ‘scanf’
foo.c:16: warning: implicit declaration of function ‘time’
foo.c:31: warning: zero-length gnu_printf format string
foo.c:13: warning: ‘a’ is used uninitialized in this function
foo.c:13: warning: ‘b’ is used uninitialized in this function
foo.c:22: warning: ‘i’ may be used uninitialized in this function
All those "uninitialised" variables are bugs.