Send two different data types over I2C?

So I m trying to send values over I2C from master to slave. I want to send both characters and integers and be able to tell which one is being received. So the example program shows you how to do this at the same time but if you want to send an integer that is larger than a 2 digit number you have to split the integer on the master side and send individual bytes. (char -> 1byte....int -> 2bytes) I m trying to understand the meaning of why the example slave receiver sketch is reading two values, the character and the byte. If the write can only send 1 byte at a time from the master why is the slave receiver receiving a character and and int?

I was thinking of just having 2 onReceive methods for receiving seperate data types but it doesnt appear that you can do this.

So i actually figured out an alternative. I wanted to send characters because I was using characters as commands and I could have just simply used the byte as a command. But for future sake if anyone wants to send a full integer from a master writer to a slave sender here is one way of doing so.

The Master Writer that sends an integer of 700 and a command of 0x03 is as follows

// Wire Master Writer
// by Nicholas Zambetti <http://www.zambetti.com>

// Demonstrates use of the Wire library
// Writes data to an I2C/TWI slave device
// Refer to the "Wire Slave Receiver" example for use with this

// Created 29 March 2006

// This example code is in the public domain.


#include <Wire.h>
int val = 700;
int myArray[2];

void setup()
{
  Wire.begin(); // join i2c bus (address optional for master)
  myArray[0] = (byte) (val & 0xFF);
  myArray[1] = (byte) ((val >> 8) & 0xFF);
}

byte x = 0x03;

void loop()
{
  send_data();
  delay(1000);
}


void send_data()
{
  Wire.beginTransmission(100); // transmit to device #4
  Wire.write(myArray[0]);        // sends five bytes
  Wire.write(x);              // sends one byte  
  Wire.endTransmission();    // stop transmitting
  delay(500);
  
  Wire.beginTransmission(100); // transmit to device #4
  Wire.write(myArray[1]);        // sends five bytes
  Wire.write(x);              // sends one byte  
  Wire.endTransmission();    // stop transmitting
  delay(500);
}

The Slave Receiver receiving an int of 700 and a command of 0x03 is as follows

// Wire Slave Receiver
// by Nicholas Zambetti <http://www.zambetti.com>

// Demonstrates use of the Wire library
// Receives data as an I2C/TWI slave device
// Refer to the "Wire Master Writer" example for use with this

// Created 29 March 2006

// This example code is in the public domain.


#include <Wire.h>
volatile int i = 0;
volatile int number;
int myBytes[2];
void setup()
{
  Wire.begin(100);                // join i2c bus with address #4
  Wire.onReceive(receiveEvent); // register event
  Serial.begin(115200);           // start serial for output
}

void loop()
{
  delay(100);
}

// function that executes whenever data is received from master
// this function is registered as an event, see setup()
void receiveEvent(int howMany)
{
  while(1 < Wire.available()) // loop through all but the last
  {
     myBytes[i] = Wire.read(); // receive byte as a character
    //Serial.println(c);         // print the character
  }
  byte x = Wire.read();    // receive byte as an integer
  Serial.println(x);         // print the integer
  i++;
  if(i == 2)
  {
    i = 0;
    number = myBytes[0] | myBytes[1] << 8;
    Serial.println("The number is: ");
    Serial.println(number);
  }
}