There are no “unwanted braces” in this code. There is an anonymous block, which is not an error. In fact, it is allowed by the spec.
Your variable k
is defined in the main scope, but then shadowed in the anonymous block.
int main() {
int k = 0;
{
int k = 1;
// do more stuff with k
}
// k is still 0 here.
}
When I was programming C, something like 1000 years ago, I would have had stern words for a dev on my team who tried using this trick.