What is the correct way to call this function?

I'm calling a function to read information into a buffer. The function definition from the library is:

    int Client::read(uint8_t *buf, size_t size)

Do I call as:

    int result;
    char buf[100];
    result = xxx.read(buf,100);

or

   int result;
   char buf[100];
   result = xxx.read(&buf,100);

or do I need to pass the buffer in a different way?

Thank you.

That will cause a compiler error because the function is looking for a pointer to a unit8_t but &buf is a pointer to a char array of size 100. Note, even the first code may cause errors when compiled for certain platforms (like ESP32) as they may have options set to prohibit implicit conversion from char * to uint8_t *

@IraSch when the function awaits an uint8_t why not use a buffer in uint8_t in first place?

Furthermore I would hand over the calculated size

  int result;
  uint8_t buf[100];
  result = xxx.read(buf, sizeof(buf));

Thank you all for the information. Everything works just fine.