[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Cpp Question
From: |
Joerg Wunsch |
Subject: |
Re: [avr-gcc-list] Cpp Question |
Date: |
Thu, 4 Sep 2003 17:13:14 +0200 (MET DST) |
As "=?ISO-8859-2?Q?Matja=BE_Jane=BEi=E8?="
<address@hidden> wrote:
>I'm trying to program a function which returns values as parameters:
>
>void foo(int a, int b, float c)
>{
>b++;
>c=sqrt(a+b)
>}
>
>but it does't work
Sure. If you want to program in C, well, you gotta learn
it. This is basically a C beginner's questin, unrelated
to the AVR.
Basically, you need to calculate the address yourself.
void foo(int a, int *b, float *c)
{
(*b)++;
*c = sqrt(a + *b)
}
And you have to call it with
foo(a, &b, &c);
C++ has the concept of reference parameters which is closer to the
Pascal var parameters.
--
J"org Wunsch Unix support engineer
address@hidden http://www.interface-systems.de/~j/