First of all the code for (a=4; a<5; a=a++)
is undefined behaviour, you probably meant for (a=4; a<5; a++)
which 'loops' a from 4 to 5 (essentially just running the loop once on the value a=4.
To use a value found inside the loop outside of it, it must be declared outside of it. Therefore your intended code was likely:
while (1) {
<type> result;
for (...) {
...
result = ...;
}
//use result here all you want
}