It may not be the most desirable solution, but you could create a nested function to 'shadow' names. int main(){ int i; void func(){ int i; } func(); }