Hi,
I have two issues, I hope you guy can help.
Here's an example I have prepared:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
#include <curses.h>
#include <stdafx.h>
double Array[10];
int x;
int main ()
{
initscr();
printw("Extracting value from loop\n\n");
Array[5]=12345;
for (x=0; x++; x<10)
{
Array[x]=1;
printw("Array %d value is now %f\n\n",x, Array[x]);
Sleep(200);
refresh();
}
printw("Value extracted is: %f\n\n",Array[5]);
refresh();
getch();
endwin();
return 0;
}
|
My first problem is that the "for" loop for some reason is not working, the program just skips it (?!), why that ?
My second issue is that, even if the "for" loop is working, for some reason the
"printw("Value extracted is: %f\n\n",Array[5]); " command instead of returning 1, is still returning 12345.
In other terms I don't know how to make a reference, in an command that is outside the "for" loop, to an array whose results are feeded by this same loop.
Can anyone share his knowledge ?
Many thanks and regards,
Wissam