Hit trouble again

Hi again with out looking a fool I spent a few nights now looking at my very basic code to find what is wrong.

In my last post I was having to Arduino chat to each other via Serial. Sorted that one :smiley: thanks to the pointers in the correct direction. But
My mega to Mega Serial connection suffers from a lot of interference and it just print L and K or ÿ so I have had to connect them over the SDA and SDL which works find the trouble is making that a usable data for a If statement.

// 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
char c = Wire.read(); // receive byte as a character
c = Serial.print(c);

int x = Wire.read(); // receive byte as an integer
Serial.println(x); // print the integer

void loop()


I know there is nothing in the Void Loop part because I have deleted everything I have tried so a little pointer would be a great help I have looked all over the internet using Google and cant seem to find what I am looking for. Once this is done I can stop posting as my project will be so close to finished

try Serial.write(c); ??

Sorry i dont think i made it clear .
i send
i get
which is fine what i need is to beable to use that to do If (x is xxxx) then ..... which is the bit im struggling with and where the code doesn't work

if (x == 49)

and so on

is my aim

receiveEvent() is an interrupt service routine. You can NOT call functions that need interrupts enabled, as Serial.print() does, in an ISR.