Call by reference and pointer parameters

Category: C/C++ -> C Author: jiangjiansong Date: 2002-04-04 20:02:18
2002-04-04 20:02:18
Teacher told me not to call the c + + reference characteristics, type function (type & x) and c pointers as arguments type function2 (type * y) mix, said that this would go wrong.

In addition, he said the c language data structure described program should not appear reference calls.

(my door is YanWeiMin textbook version of the c language to describe the data structure, which occur several times a pseudo code similar type function (type & x) the reference calls)

Well, I want to ask, this is not really not? Really professional programmers in programming, will call by reference and pointer parameters used mixed with it, that is a pointer parameter will be used, while another call by reference. What are the pros do it?
2002-04-04 20:10:28
Of course not, I studied materials and data structures like you for references can be replaced with a pointer, but the realization of the function body should some of the trouble. Example: type function (type & ; x) {x = y;} ----- type function (type * x) {(* x) = y;}. c does not support referencing this way, you can see for yourself.
2002-04-04 20:22:33
I mean; invoked by reference to certain functions, and some function and use pointer argument, of course, inside the function body is a unified , all the way to achieve to take a call.

not do so? ?

I can compile and run it no problem! !
2002-04-04 20:37:53
essentially the same ... I think the internal references with pointer implementation mechanism should be the same. . . Your teacher wrong, right? ? Why not mix. .
2002-04-04 20:41:23
can mix, oh, say our last course design program written on pointers, references mix, but the TC can not naturally be compiled.
2002-04-04 20:49:09
are passed address. However, semantic references and pointers is not the same now, you can look at c + + standard reference is how to explain.