Complex-type parameters and functions

T

tsoukase

Hello,

I am beginner in C.
My questions are:
Can a function take as parameters complex-type variables (ie. struct)?
Can a function return such a complex-type value?

It seems efficient if someone can use such programming structures.

Than you
Evangelos Tsoukas
 
E

Eric Sosman

Hello,

I am beginner in C.
My questions are:
Can a function take as parameters complex-type variables (ie. struct)?
Can a function return such a complex-type value?

Yes and yes.
It seems efficient if someone can use such programming structures.

As a "beginner in C," you should not distract yourself
with questions of the efficiency of individual operations.
Learn the language, learn how to express efficient algorithms
in the language, and do not worry about whether passing a
single `struct' argument to a function is seventy nanoquivers
faster or slower than passing five `int' arguments. The
answers to such questions are specific to one machine, one
compiler, one set of compiler flags -- they can even vary
from one occurrence to another within a single program.

Jackson's Laws of Computer Program Optimization:

First Law: Don't do it.

Second Law (for experts only): Don't do it yet.
 
K

Keith Thompson

I am beginner in C.
My questions are:
Can a function take as parameters complex-type variables (ie. struct)?
Can a function return such a complex-type value?

Yes, and yes. But avoid the term "complex"; it refers specifically to
mathematical complex numbers (a standard feature in C99).
 
T

tsoukase

Thank you for the remarks.

With "efficient" I meant a useful tool for programming.

I am going to try some functions like

struct aFunction (struct)
and see waht happens.
 

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

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top