user14408: In the master write/ slave read example for the wire library, there is an integer declared howMany that is never used.
 void setup() {
   Wire.begin(8);                // join i2c bus with address #8
   Wire.onReceive(receiveEvent); // register event
   Serial.begin(9600);           // start serial for output
}

void receiveEvent(int howMany) {
  while (1 < Wire.available()) { // loop through all but the last
   char c = Wire.read(); // receive byte as a character
   Serial.print(c);         // print the character
}
 int x = Wire.read();    // receive byte as an integer
 Serial.println(x); 
}

As the function does not work without it, i would like to know what is its exact purpose.I would imagine that is something regarding the buffer size.

user10794: The reference page https://www.arduino.cc/en/Reference/WireOnReceive states:

Parameters
handler: the function to be called when the slave receives data; this should take a single int parameter (the number of bytes read from the master) and return nothing, e.g.: void myHandler(int numBytes)

I suggest you look at the reference pages for the functions in future before asking what they do.

user4143: It tells you how many bytes have been received, and consequently how many you can read with Wire.read(). 
Before you have read anything with Wire.read() Wire.available() will return the same value.  As you read from the buffer Wire.available() will decrease, but howMany will stay the same.

14408: <p>In the master write/ slave read example for the wire library, there is an integer declared howMany that is never used.</p>

<pre><code> void setup() {
   Wire.begin(8);                // join i2c bus with address #8
   Wire.onReceive(receiveEvent); // register event
   Serial.begin(9600);           // start serial for output
}

void receiveEvent(int howMany) {
  while (1 &lt; Wire.available()) { // loop through all but the last
   char c = Wire.read(); // receive byte as a character
   Serial.print(c);         // print the character
}
 int x = Wire.read();    // receive byte as an integer
 Serial.println(x); 
}
</code></pre>

<p>As the function does not work without it, i would like to know what is its exact purpose.I would imagine that is something regarding the buffer size.</p>
 10794: <p>The reference page <a href="https://www.arduino.cc/en/Reference/WireOnReceive" rel="nofollow noreferrer">https://www.arduino.cc/en/Reference/WireOnReceive</a> states:</p>
<blockquote>
<p>Parameters</p>
<p>handler: the function to be called when the slave receives data; this should take a single int parameter (the number of bytes read from the master) and return nothing, e.g.: <code>void myHandler(int numBytes)</code></p>
</blockquote>
<p>I suggest you look at the reference pages for the functions in future before asking what they do.</p>
 4143: <p>It tells you how many bytes have been received, and consequently how many you can read with <code>Wire.read()</code>. </p>

<p>Before you have read anything with <code>Wire.read()</code> <code>Wire.available()</code> will return the same value.  As you read from the buffer <code>Wire.available()</code> will decrease, but <code>howMany</code> will stay the same.</p>
