You should have seen 6, 6, 7, 6, 7 then received an undefined reference error. The returned functions share the closed environment, but not between new instances.