Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > multidimensional arrays

Reply
Thread Tools

multidimensional arrays

 
 
Stefan Ram
Guest
Posts: n/a
 
      04-25-2011
Here is a programming exercise, I just made up after reading
the other thread named »multidimensional heap arrays«:

Write the following functions (using stdarg.h):

a = aalloc( n, ... )

Allocates an n dimensional int array with the n extensions
given after the first argument, for example, aalloc( 2, 3, 6 )
for a two-dimensional 3x6 array. The type of »a« might be
whatever you need, it does not have to be an array type of
the language C, but also might be a pointer to a struct or so.
It does only need to be accessible by the following other
operations:

int aget( a, ... )

Get the value at the position given by the arguments after
the first argument. (The behavior only needs to be defined
for the case that there are n such arguments, when »a« is
the result of a preceding call to aalloc( n, ... ).)

aset( a, i, ... )

Sets the value at the given position ... to i.

aprint( a, FILE * )

Serialize the array to the file.

aread( a, FILE * )

afree( a )

Release all the resources allocated in a preceding aalloc.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
casting pointers/arrays to multidimensional arrays Francesco C++ 2 11-06-2009 09:04 AM
Multidimensional arrays and arrays of arrays Philipp Java 21 01-20-2009 08:33 AM
Multidimensional arrays in Struts form? geclinke Java 1 06-18-2004 03:31 PM
Multidimensional arrays? anything else? d[ - - ]b ASP .Net 2 05-18-2004 12:17 PM
Cast to multidimensional arrays Jay Java 1 01-30-2004 04:27 PM



Advertisments