- #1
Nobody
- 18
- 1
Thanks for the help
I have another problem,
int foo(){
int n=rand()%2
switch(n){
case 0:
h=1;
break;
case 1;
h=0;
}
return h;
}
void mat(int a[][5]){
for(i=0;i<5;i++)
for(j=0;j<5;j++)
a[j]=foo();
}
And in main function I can only print out all 0's or all 1's. There are no random values at all ? Why no random values ?
If you can, please explain this in assembly code and in the above C code also, I'm very grateful.
Thanks a lot
I have another problem,
int foo(){
int n=rand()%2
switch(n){
case 0:
h=1;
break;
case 1;
h=0;
}
return h;
}
void mat(int a[][5]){
for(i=0;i<5;i++)
for(j=0;j<5;j++)
a[j]=foo();
}
And in main function I can only print out all 0's or all 1's. There are no random values at all ? Why no random values ?
If you can, please explain this in assembly code and in the above C code also, I'm very grateful.
Thanks a lot