Hi, Geo,
I would like use the second way. Because it can protect the fields (or
elements) of the "random" from being changed in the function.
Do you know the differences from these two ways:
int i;
1) function(i);
2) function(&i);
And you can write a piece of codes to check it .
I am a "rookie". If you find any mistake in what I said, pls let me know.
George Zhang
"geo" <geometrikal@hhoottmmaaiill> 写入消息新闻
:clcm-20030623-...
> hi all
>
> say if i had :
>
> struct random_struct {
> .....
> .....
> .....
> }
>
> struct random_struct random;
>
> and then i had a function which used this structure. What is the best
> programming practice:
>
> void function(struct random_struct * r) {
> .......
> }
>
> function(&random);
>
> or:
>
> void function(struct random_struct r) {
> .......
> }
>
> function(random);
>
>
> and why?
>
> Thanks
> Ross
> --
> comp.lang.c.moderated - moderation address:
--
comp.lang.c.moderated - moderation address: