Coder's Guild Mailing List

Re: import a value for const int?

Posted by Matthew Pratt on 1999-04-29

--- Case Deis <casedeis@xxxxxx.xxx> wrote:
> Thank you so much for the code for a linked list. 
> It should be a big help.
> As I believe it will take me a while to figure out
> the code you provided, I need a temporary solution
> to my problem of varying array size. I think I have
> a solution, but I want to ask everyone if this will
> work or not.
> 
> What if I wrote a different program to count how
> many items was in the data file and then somehow
> imported this value to my main program, making it a
> const int?
> Then I could declare the structure array as follows:
>  StructArray[Size]
> 
> Will this work?  If so, any idea how I can link two
> different programs in such a way?  Thanks again.

The only way this would work is if the first program
compiled the second. No goo

I cant remember what your wanted to store, but has
anyone here told you about ma

For example if you wanted and array of integers you
could allocate the memory to

int *array;
int array_size = 100; //can determine this at run time

array = (int *) calloc( array_size, sizeof(int) );

// now we can use array as an array
array[10] = 678;
array[0] = 1000;
array[99] = array[10] + array[0];

//done with array so give back memory
free(array);

Sounds like you need to get a good book on
programming.

===
Matty                                       .
http://members.xoom.com/mattpratt/      _--_|\
mattpratt@xxxxx.xxx                    /      \
s3099239@xxxxxxx.xxx.xxx.xx            \_.--._/<--Canberra,
W2K - The other millenium bug.               v    Australia

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com