How to create a function that returns a byte array in C++? Arduino project. : I am currently starting to learn C++ via Arduino programming. I am programming an 8*8 LED Matrix, and currently have a semi-working code that uses a joystick to control a dot on screen. Only problem is: its nearly 1000 lines long. It's equivalent to writing an 1000 page essay only saying "Pig, blanket, market" over and over again until I get to the actual logic involved.

My friend suggested to make it shorter, I could make a function which returns a byte. 

How does one do this?

http://pastebin.com/8ud9ny2U <-- This is my code. !WARNING! Not a pretty code. At all. 

Help is much appreciated.
