Subroutine should return a vector

2

2Penny

Ladies, Gentlemen -

It's been about 3 years since I translated 68000 assembly language
code into 'C' and I remember that 'C' design model that I didn't
like. 'C', as I understand it, was supposed to be modeled after
a sort of mathematical function returning one item per function call
regardless of how many parameters were passed to the function;
sorta like this ;

w = f(a,b,c,d,e......)
returned value function call( parameters passed in )

I want to return the starting address of a list of returned
parameters. How do I set this up?

2Penny
 
J

James Kuyper

2Penny said:
Ladies, Gentlemen -

It's been about 3 years since I translated 68000 assembly language
code into 'C' and I remember that 'C' design model that I didn't
like. 'C', as I understand it, was supposed to be modeled after
a sort of mathematical function returning one item per function call
regardless of how many parameters were passed to the function;
sorta like this ;

w = f(a,b,c,d,e......)
returned value function call( parameters passed in )

I want to return the starting address of a list of returned
parameters. How do I set this up?

2Penny

While only one value is returned directly by a function, that value can
be a struct object containing multiple members, each with it's own value..

Also, the arguments to the function can be pointers to other objects,
and the function can be used to set the values of the objects pointed at.

Both of these methods allow you "return" more than one thing from a C
function.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top