What meaning bears the word "imitation" in the phrase "simulate passing arguments by reference"?
Wanted to ask what the word "simulation"?
In C, you use pointers and the indirection operator to simulate pass-by-reference. When calling a function with arguments that should be modified, the addresses of the arguments are passed.
In C pointers and indirection operator are used to simulate passing arguments by reference. When a function must change the value of argument is the address of this argument.
In si there is no such thing as a "link" (a concept from C++) and C shny code can only simulate this behavior as "pass by reference" using pointers.
Suzanne answered on April 3rd 20 at 18:30
C always passes arguments by value. To simulate passing by reference passes the value of the pointer. Always the link pass arguments Fortran and Perl. In C++ you can pass and by reference and by value.
The link is the alias, second the variable name.
A pointer is the memory address where the value is stored.
Link abstraction higher than the pointer to the memory. Link doesn't know about memory organization is just an alias. Pointer is just one of the ways of implementing links.
When passing by value a copy is made of the variable (in C to simulate call-by-reference copies the pointer).
When passing by reference - passes the alias to a variable.
Sofia_Wate answered on April 3rd 20 at 18:32
In si there is no such thing as a "link" (a concept from C++).
In C++ references are used to change the variables referenced by the link.
In C, this is done using the pointer.
To simulate a link, can the argument of the function be declared as const pointer: void func(char * const str);