pointers in C are nearly identical to references in C++. There are only a couple minor differences
1. The function that passes the argument: There is no difference in how to pass an array -- both C and C++ are identical. Passing a single object: C needs the & operator, while c++ does not
Code:
//
// *.c file
//
struct mystruct
{
int a;
int b;
};
void foo(int array[], int* b, struct mystruct* c)
{
c->a = 0;
*b = 0;
}
int main()
{
int array[5];
int b;
struct mystruct c;
foo(array, & b, &c);
}
Code:
//
// *.cpp
//
struct mystruct
{
int a;
int b;
};
void foo(int array[], int& b, mystruct& c)
{
c.a = 0;
b = 0;
}
int main()
{
int array[5];
int b;
mystruct c;
foo(array, b, c);
}