:: Re: [DNG] Pointer error in the back…
Página Principal
Delete this message
Reply to this message
Autor: aitor_czr
Data:  
Para: KatolaZ, dng
Tópicos Novos: [DNG] Reference in C -- was Re: Pointer error in the backend of Netman
Assunto: Re: [DNG] Pointer error in the backend of Netman
Hi Katolaz,

Here you are an example of two arguments (x,y) passed by reference:

# include <stdio.h>

int main(void)
{

int i=1;
int j=2;

printf( "i = %d j = %d \n", i,j);

func(&i, &j);

printf( "i = %d j = %d \n", i,j);

return 0;

}

void func(int *x, int *y)
{
int k = *x;
*x = *y;
*y = k;
}

This is the output:

i = 1 j = 2
i = 2 j = 1

On 12/10/2015 06:33 PM, dng-request@??? wrote:
> On Thu, Dec 10, 2015 at 05:00:58PM +0100, aitor_czr wrote:
>> >No, Katolaz, passing by value and passing by reference exist in C,
>> >at least in C99.
>> >
> Could you please give a pointer to the place where this feature is
> documented in the ANSI C99 standard?


Passing by value and passing by reference in ANSI C99 are documented in
the following book:

C - The Complete Reference (by Herbert Schildt)

Cheers,

Aitor.