12 Years
Discussion Span
Last Post by Ancient Dragon

How about declaring an array of records without using pointers?

I get an error when I declare it this way:

Record ListOfRecords[];

I want to have an array of 100 records. Then have a pointer point to the array. This way I can pass the address to a function for processing.


If MC is a C or C++ compiler, you have to put a number inside those brackets to tell it how big that array is going to bel
Record ListOfRecords[100];

You don't need another pointer in order to pass it to another function.

// use only ONE of the following, not all three.  It shows three ways 
// to code the function.
void foo(Record ListOfRecords[100])
void foo(Record ListOfRecords[]) << this is also ok
void foo(Record* ListOfRecords) << so is this
   // blabla

int main()
   Record ListOfRecords[100];
   // pass the array to function foo()
   foo(ListOfRecords); <<< see here
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.