Below code will explains automatic variable and multi threading.
For below code , for case-1 and case-2 output is different ,
For case-1 output is 0 1 2 3 4
For case-2 output is 5 5 5 5 5
For case-2 it creates 2 parallel threads while for case-1 it is just initial assignment of automatic variable.