简体   繁体   中英

Cannot understand this piece of code (operator &) in C++

I don't understand why the & operator which mainly means "adress of" is there, I used this operator in C but in this code I don't understand it's purpose.

#ifndef _STUDENT_
#define _STUDENT_

struct Student {
    char* name;
    int mark;
};

void InitStudent(Student&);
void ShowStudent(Student);
void DeleteStudent(Student&);

#endif

The & in Student& means that you are passing a (non-const) reference to a Student instance. It's not the C "address-of" operator.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM