Why is this accepted by the compiler ? [SOLVED]

I am learning about LoRa and using a library for the RFM95 radio. The code in the sketch calls a method in the library

The method expects an int for a parameter but the call to the method is absent of any parameters.

Why it compiles and doesn't cause and error.

Using a c++ compiler I tried to call a method that expected an int but got the error "to few arguments to function"

In the arduino ide the code compiles fine.

Heres the call to the method that is in my sketch


Heres the code in the lib.

int LoRaClass::beginPacket(int implicitHeader)
  if (isTransmitting()) {//if in tx mode just return
    return 0;

  // put in standby mode, idle is same as standby mode

  if (implicitHeader) {
  } else {

  // reset FIFO address and paload length
  writeRegister(REG_FIFO_ADDR_PTR, 0);
  writeRegister(REG_PAYLOAD_LENGTH, 0);

  return 1;

Never mind. I just saw in the this in the header file
I am not a c++ programmer so I didn’t look for this.

lass LoRaClass : public Stream {

int begin(long frequency);
void end();

int beginPacket(int implicitHeader = false); <-------
int endPacket(bool async = false);

Look in the associated header file; you will see that there is a default value specified in the function prototype.

Ah, you already found it ;)

What does the function prototype in the .h file look like ?

It looks like this

int beginPacket(int implicitHeader = false);

OP: Could you add [solved] to the title of this post?

noweare: It looks like this

int beginPacket(int implicitHeader = false);

As suggested, the function prototype is providing a default value for the function parameter