I guess you expect everyone to be mind readers. You will have to post your code
Ancient Dragon
Retired & Loving It
30,050 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
what is variable "address"? where did you declare it?
also post the code that wrote the file. and the first line or two of the file contents.
>>static_cast(address);
that line does nothing at all. you might as well delete it.
Ancient Dragon
Retired & Loving It
30,050 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
Why are you using this form: (a + i*arraysize +j) rather than subscript notation a[i][j] ?
It's simpler, for one, and it is also easier to see that (a + i*arraysize +j) means the same as &a[i][j] .
Or that *(a + i*arraysize +j) means the same as a[i][j] .
So what you are putting into your file are not the values you have created, but their location -- which is fairly meaningless.
It might be helpful to output some text into the file to denote matrices, and perhaps make them look like 2D matrices rather than one long column.
Also, MSVC6 uses incorrect scoping rules with variables declared in a for loop. I'd say just move your i, j, q outside of the loops.
And do you instead want % here?
a[i][j]=rand() * 20 + 1 ;
And main returns an int.
You may want to seed your random number generator. Often srand(time(0)); is used.
Dave Sinkula
long time no c
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314
Good but provide CPP from basic
Pointless reopening of 4 years old thread and on top of that absolutely rubbish advice.
Thread closed
peter_budo
Code tags enforcer
15,436 posts since Dec 2004
Reputation Points: 2,806
Solved Threads: 902