#include <stdio.h> #include <conio.h> extern int x = 0; void main() { { int x = 1; } printf("%d", x); getch(); }</blockquote> What is output

#include <stdio.h>
#include <conio.h>
extern int x = 0;
void main()
{
{
int x = 1;
}
printf("%d", x);
getch();
}</blockquote>
What is output ?
A. 0
B. 1
C. Error Comlier
 

Khanh Châu

New member
Hướng dẫn
Chọn A là đáp án đúng
Xem lời giải
Xem lời giải
Khai báo int x = 1, x ở đây là biến local và chỉ có giá trị trong {}. Hàm printf() ở ngoài {} sẽ dùng giá trị của biến x = 0.