delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/07/14/23:00:13

Xref: news2.mv.net comp.os.msdos.djgpp:5977
From: Bob Platko <platko AT ix DOT netcom DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Question to the Experts
Date: Sun, 14 Jul 1996 22:15:24 -0400
Organization: Netcom
Lines: 44
Message-ID: <31E9A9BC.495A@ix.netcom.com>
NNTP-Posting-Host: clv-oh13-41.ix.netcom.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I have a few questions for the C experts out their.

The reason I posted this in the DJGPP newsgroup is because many of
the code that I see does not seem to compile under GCC, since most
compilers don't strictly follow the ANSI C standard or they mix C and
C++.  (And I use GCC a thousand times to one than TCC) :)

Anyways, I'm writing a program that handles some 3d graphic routines.
Yet, I am having some problems with some non-graphic related stuff.

So here's my questions:

1.  How can you pass undetermind sized arrays to a function?

    Let's say I have a function:

    void RotateObject(int x, int y, int z, object[][][])

    See the []'s.  I have a 3 dimention array that holds the object:

      object[Num_of_Polys][Poly_Points][Coordinates]

    Now each object being feed to the function has a diffrent number
    of polygons, or sides.  Thus, the Num_of_Polys will be different.

    Heres what I came up with, but I can't get it to work.

    void RotateObject(int x, int y, int z, int num_of_sides, object);
                                                             ^^^^^^
    I know that is wrong.  How do I get around it.  BTW, object is
    an integer.

2.  How do I return multiple values from a function?

    The function described above must return the new coordinates.
    I heard besides using return, you can also use a pointer to
    return the value through a argument in the fuction.  How do I
    do this with arrays?



Thanks for any help.

BP

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019