CAN-BUS read message buffer

Can someone explain why “&len” is used in “CAN.readMsgBuf(&len, buf);”?

I am using the github CANBUS library for the seed studio (v2) CAN shield:
https://github.com/Seeed-Studio/CAN_BUS_Shield/blob/master/README.md

I know that “&” is a C++ pointer but I cannot wrap my head around why it is being used in this context.

void loop()
{
unsigned char len = 0;
unsigned char buf[8];

if(CAN_MSGAVAIL == CAN.checkReceive()) // check if data coming
{
CAN.readMsgBuf(&len, buf); // read data, len: data length, buf: data buf

unsigned long canId = CAN.getCanId();

Serial.println("-----------------------------");
Serial.print(“Get data from ID: 0x”);
Serial.println(canId, HEX);

for(int i = 0; i<len; i++) // print the data
{
Serial.print(buf*, HEX);*

  • Serial.print("\t");*
  • }*
  • Serial.println();*
  • }*
    }

the first parameter of readMsgBuf() is a pointer to byte (it expects an address)

byte MCP_CAN::readMsgBuf(byte *len, byte buf[])

you pass the parameter as an address (a pointer) using the & operator (address of operator)

unsigned char len = 0;
    unsigned char buf[8];

    if(CAN_MSGAVAIL == CAN.checkReceive())            // check if data coming
    {
        CAN.readMsgBuf(&len, buf);

the function returns the number of bytes received in the parameter len which you then use to print the data received

   for(int i = 0; i<len; i++)    // print the data
        {
            Serial.print(buf, HEX);