array, pointer & adressOf

Can I get away with something like this:

#ifndef cArc_h
#define cArc_h

#include "Arduino.h"

struct cArc{
	float startAngle ;
	float endAngle ;
	float xRadius ;
	float zRadius ;
	boolean clockwise ;
} ; //end struct

#endif

#ifndef cPoint_h
#define cPoint_h

struct cPoint{
	float x ;
	float y ;
	float z ;
} ; // end struct cPoint

#endif

///////////////////////// 
// inside a cPen .cpp Class:

cPoint[] cPen::buildArc( cArc Arc ){
	cPoint Points[ Arc.endAngle - Arc.startAngle ] ;
	//function fills cPoint array
	return Points ;
}
// inside the cPen .h :
public:
	cPoint[] buildArc( cArc ) ;
	...
	..

or will I have to implement something with pointers & adressOf

Array dimensions must be compile-time constants. To make dynamic-size arrays of structures you should use malloc() to allocate memory.

Thanks johnwasser,
Can I get away with

cpp:
void cPen::buildArc( cArc Arc , cPoint[] & refArray ){ ... }

.h:
void buildArc( cArc , cPoint * ) ;

main:
cPen pen( ... ) ;
cArc arc = ... ;
cPoint[10] retArray ;
pen.buildArc( arc , retArray ) ;

The syntactic shift between & and * in the function 'signatures' are confusing.

johnwasser:
Array dimensions must be compile-time constants. To make dynamic-size arrays of structures you should use malloc() to allocate memory.

what about:
cPoint Points[] = new cPoint[ Arc.endAngle - Arc.startAngle ] ;

Array dimensions must be compile-time constants.

That's a pretty broad generalisation, and like so many generalisations, untrue.

Consider:

int fn (int arraySize)
{
  int array [arraySize];
  ...
}

Carsten53T:
Can I get away with something like this:
...
or will I have to implement something with pointers & adressOf

If no-one is watching, maybe.

How about stating the real problem?

;o) Nick .. you evaded my question
My problem is that I cannot 'think' in terms of addressOf and pointers. It may probably be bad netEtikette to play the ball up against the lot of you, instead of trying out what works. I can get something like a dynamic container of simple structures to work .. but if I look at the code tomorrow, I'll be lost. I've had my nose in Deitel & Deitel's "C++" for some time.

Am I right in that & is used in two different ways (not considering string concatenation and logic). One as an operator .. the other as?

I'll eventually get to be able to juggle the stuff well enough to do DirectX3D, but I just caught sight of the ease of PROCESSING and am sort of caving in on the C++.

int number ;
.. can I think of "int * " in
int * ptrNumber ;
as an lValue of type (int *) that equals the rValue &number. Equal in the sense that they are identical but must be placed left and right.

I think that I get it:
cpp:
void doSomething( int angle ) ; ... here angle is an lValue
main:
doSomething( 24 ) ; ... here 24 is an rValue

Carsten53T:
;o) Nick .. you evaded my question
...
Am I right in that & is used in two different ways (not considering string concatenation and logic). One as an operator .. the other as?

I'll eventually get to be able to juggle the stuff well enough to do DirectX3D, ...

I try to be helpful, really I do. But when you ask on the Arduino forum about doing DirectX3D, are you sure you are in the right place? If you could relate your question to the Arduino, that might help.

Nick just pointed out that you didn't present a real question that can be answered. But my answer to you question is "Yes, you have to implement something with pointers & adressOf."

You really cannot write anything but the most trivial C++ programs unless you have a good grasp of pointers.

Look at this
http://troelsgaard.net/images/ct_Images/Positioner/DSC01125.JPG
except for a hairdo and a flexible format for 'communicating' working parameters .. she is perfect!
It has come to be thanks to you and the help you offer.

EDit: Forgt to mention that I've been working with 3d-modelling and has the option to take a tangent toward combining the two