void main() { int x=0; { int x = 0, y = 0; y++; x++; } printf("%d", x); getch(); }</blockquote> Output of following code?

void main()
{
int x=0;
{
int x = 0, y = 0;
y++;
x++;
}
printf("%d", x);
getch();
}</blockquote>
Output of following code?
A. 1
B. Error
C. 0
 

Khanh Châu

New member
Hướng dẫn
Chọn C là đáp án đúng
Xem lời giải
Xem lời giải
Giải thích: biến x được khai báo trong ngoặc {} là biến local, hàm printf() sẽ lấy giá trị x = 0.