Hi guys...
I do not understand why the hell have I to initialize a vector. For example it is sensible, up to me, to initialize a scalar in this situation
Code:
int foo(int a)
{
int i, res=0; //ok, great idea!!! otherwise bad random result
for(i=0; i<a;i++) res+=i;
return(res);
}
but in this one I not agree
Code:
void foo2(int *res, int a)
{
int i, res=0; //ok, great idea!!! otherwise bad random result
for(i=0; i<a;i++) res[i]=i;
}
int main()
{
int *res, ini_res[10], i;
res=&ini_res[0];
foo2(res, 10);
for(i=0; i<10;i++) printf("%d\n",res[i]);
}
but I am getting bad result without initializing ini_res...
Has somebody a clue?