In the following program where is the variable a getting defined and where it is getting declared?
#include <stdio.h>
void main()
{
extern int a;
printf("\n a = %d", a);
}
int a = 20;
#include <stdio.h>
void main()
{
extern int a;
printf("\n a = %d", a);
}
int a = 20;
Extern int a is declaration, int a = 20 is the definition
Int a = 20 is declaration, extern int a is the definition
Int a = 20 is definition, a is not defined
a is declared, a is not defined
Hãy suy nghĩ và trả lời câu hỏi trước khi xem đáp án
Tổng hợp câu hỏi trắc nghiệm lập trình C/C++ có đáp án và lời giải đầy đủ nhằm giúp các bạn dễ dàng ôn tập lại toàn bộ các kiến thức.