You can't. And there are four reasons why that won't work (that I can think of).
Firstly, myBytes is a local variable so goes out of scope (memory is deleted) when you return.
Secondly, that is not how you declare an array.
Thirdly, C/C++ don't allow it - an array is really just a pointer to the start of a block of memory. If you want to return the array, you can only return a pointer to the memory it occupies (see first point).
Fourthly, you can't copy one array to another with an '=' sign.
Thanks for all the responses, I'm new to accessing pointers through classes so bare with me.
I'm doing an I2C project and I want to send two byte data packets over the twi. I don't exactly have a lot of time to do a calculation, typecast and send the response once it has been requested. So I want to place a public pointer to the two bytes in my class. I will do the calculation and type cast from the main loop over an interval and update the public data in the class so that the TWI can simply read it when it needs to.
I don't exactly have a lot of time to do a calculation, typecast and send the response once it has been requested.
The cast takes no time at all.
Posting code that actually compiles is generally preferred over code that obviously won't.
Pre-splitting the int into two bytes doesn't save much time. The highByte() and lowByte() "functions" are macros that are resolved at compile time. The resulting code is simply some bit shifting and masking, which are very fast operations.
I think you are creating a mountain out of a molehill.