Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Complex-type parameters and functions

Reply
Thread Tools

Complex-type parameters and functions

 
 
tsoukase@gmail.com
Guest
Posts: n/a
 
      04-15-2005

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

 
Reply With Quote
 
 
 
 
Eric Sosman
Guest
Posts: n/a
 
      04-15-2005


http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> 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.

--
(E-Mail Removed)

 
Reply With Quote
 
 
 
 
Keith Thompson
Guest
Posts: n/a
 
      04-15-2005
(E-Mail Removed) writes:
> 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).

--
Keith Thompson (The_Other_Keith) (E-Mail Removed) <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
 
Reply With Quote
 
tsoukase@gmail.com
Guest
Posts: n/a
 
      04-16-2005
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.

 
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
Static methods and passing functions as parameters. JBB123 Java 1 12-08-2011 09:13 AM
Class Member Data and Member Function Parameters - Should Parameters Be Data Members? Jason C++ 2 05-13-2006 07:11 AM
functions and parameters Richard C++ 8 10-21-2005 06:11 PM
please help me in distinguish redefining functions, overloading functions and overriding functions. Xiangliang Meng C++ 1 06-21-2004 03:11 AM
Pointers to member functions and default parameters Dave C++ 2 04-30-2004 02:52 PM



Advertisments