3 ms·
No, you're incorrect, C and Java do have block scope. It would have taken like 5 seconds to verify that. In C: #include <stdio.h> int main() {
by dhconnelly 14y ago
No, you're incorrect, C and Java do have block scope. It would have taken like 5 seconds to verify that. In C:
#include <stdio.h>
int main() {
if (1) {
int a = 5;
}
printf("%d\n", a);
return 0;
}
==> test.c:6: error: ‘a’ undeclared (first use in this function)