T-57:
The question is not whether or not i should use a function, the question is how to take the value of the function and make it into a displayable set of digits.
What in your mind is "the value of the function". In your code you have defined an integer variable and a function to have the same name, C will not allow you to do this for a good reason, it make no sense.
A function can return a value but it can not have a value intrinsically.
T-57:
Maybe you should get som(e) LEDs once in a while, power them to 1023 with analogWrite, and marvel at the glow. I've been doing it for weeks.
Correction, you have been deluding yourself for weeks into thinking just because you put 1023 into the code the computer actually sent 1023 into the PWM output. The computer plays modular arithmetic with the values you send to analogue write such that it only actually sends the 8 least significant bits to the counters. So send what value you like but only the first 255 values get through. This is performing the AND operation on the value you send with a value of 255 ( or 0xff ) before it gets to the hardware.
So 255 is the same as 511, is the same as 1023, is the same as 2047, is the same as 4095.
Write some code to flash an LED at all those values in turn and marvel at the glow not changing one little bit.