Code:
#include<stdio.h>
#include<conio.h>
void main(){
int x[10],i,square=0;
clrscr();
for(i=0;i<10;i++)
square=x[i]*x[i];
printf("square=%d",square);
getch();
}
Now lets look at it closer ( btw u use code tags like this [ code ] to close it [ /code ] - of course without the spaces between [ and / and [ and c ///hope that makes sense)
First of all never use void main use
int main and return 0 at end of main
Do not use clrscr see FAQ why it is a bad thing to use, there are more portable ways.+ i dont see any need of using that function here.
Now look at this piece of code
Code:
#include<stdio.h>
#include<conio.h>
int main(){
int x[10];
int i;
int square=0;
for(i=0;i<10;i++){
square=x[i]*x[i];
printf("square=%d\n",square);
}
getch();
return 0;
}
when u compile everything is still oke but when u run it you should get pretty strange outputs...
HINT: i didnt define something, in other words there is something undefined in your code which causes all your poblems...
Try and see if you can solve it now....