counter used in for loop is initialized. earlier it was defined inside the loop