Complex-type parameters and functions

Discussion in 'C Programming' started by tsoukase@gmail.com, Apr 15, 2005.

  1. Guest

    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
    , Apr 15, 2005
    #1
    1. Advertising

  2. Eric Sosman Guest

    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.

    --
    Eric Sosman, Apr 15, 2005
    #2
    1. Advertising

  3. 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) <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.
    Keith Thompson, Apr 15, 2005
    #3
  4. Guest

    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.
    , Apr 16, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. news.amnet.net.au
    Replies:
    1
    Views:
    573
    =?UTF-8?b?TMSByrtpZSBUZWNoaWU=?=
    Apr 13, 2004
  2. Ulf Heyder
    Replies:
    1
    Views:
    492
    Patrick TJ McPhee
    Oct 28, 2003
  3. Chishun Kwong
    Replies:
    0
    Views:
    417
    Chishun Kwong
    Mar 3, 2005
  4. Stanimir Stamenkov
    Replies:
    2
    Views:
    744
    Stanimir Stamenkov
    Oct 25, 2005
  5. Robert Mark Bram
    Replies:
    0
    Views:
    682
    Robert Mark Bram
    Feb 4, 2007
Loading...

Share This Page