There's a Freudian bug in your code:
void delay(){
int i = 10000;
int x = 0;
while(x != i) {
x += x + 1;
}
}
I guess you meant:
x += 1;
Typically, you may want to make your loop termination using the <, <=, >=, > operators instead of the == or !=:
void delay(){
int i = 10000;
int x = 0;
while(x < i) {
x += 1;
}
}