I see how it can be misconstrued; ofcourse the OP can simply use a pointer and an offset in a loop for array assignment as in
Code:
*(mincost + i) = *(dist[0] + i);
Translated code is:
Code:
mincost[i] = dist[0][i];
Originally Posted by Adak
io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
Originally Posted by Salem
You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.
Outside of your DOS world, your header file is meaningless.
This is a late response but thanks to all your responses.
I used a loop, since there are only 15 items.
But I wanted to code correctly,(considering the case of having 999999999999 items).
-cheers
You need to use dynamic memory management - ie malloc and free. And keep track of the size so you can resize it and know how many times to iterate.
Originally Posted by Adak
io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
Originally Posted by Salem
You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.
Outside of your DOS world, your header file is meaningless.