Regarding Return

Hi Guys, I am facing a issue with return. Here is the code :-

void setup() {

int i;
i= x();

int x()
int a;


return a;

void loop() {


I was expecting '101' value to be printed but it prints '100'. However, if i remove return, it correctly prints '101'. Can you help me explain why return is causing this effect? Is it returing a (100) as semicolon is missing after return?

return a=100;What the compiler saw.

a = 100 is an expression, which assigns 100 to a, then returns that value (100) as its result. You
returned it.

If you’d enabled compiler warnings it would have complained about the rest of the function being unreachable code…