SarkariBix
SarkariBix
Start typing & press "Enter" or "ESC" to close
  • Home
  • Jobs
  • Results
  • Current Affairs
  • GK
  • Online Test
  • HR Interview
  • BLOG

In the following program where is the variable a getting defined and where it is getting declared? #include int main() { extern int a; printf("%d\n", a); return 0; } int a=20;

  • Home
  • Computer Science & Engineering
  • C Programming Questions and Answers
  • Declarations and Initializations
  • Discuss - 701
1. 

In the following program where is the variable a getting defined and where it is getting declared?

#include<stdio.h>
int main()
{
    extern int a;
    printf("%d\n", a);
    return 0;
}
int a=20;
[A]. extern int a is declaration, int a = 20 is the definition
[B]. int a = 20 is declaration, extern int a is the definition
[C]. int a = 20 is definition, a is not defined
[D]. a is declared, a is not defined

Answer: Option A

Explanation:

- During declaration we tell the datatype of the Variable.

- During definition the value is initialized.

Workspace Report
Leave a Comment

Computer Science & Engineering :: C Programming Questions and Answers : More Exercises

  • Declarations and Initializations
  • Expressions
  • Functions
  • Pointers
  • Strings
  • Input / Output
  • Bitwise Operators
  • Const
  • Variable Number of Arguments
  • Library Functions
  • Control Instructions
  • Floating Point Issues
  • C Preprocessor
  • Arrays
  • Structures, Unions, Enums
  • Command Line Arguments
  • Typedef
  • Memory Allocation
  • Complicated Declarations

Questions & Answers

Aptitude Chemical Engineering Civil Engineering Computer Science & Engineering Current Affairs Data Interpretation Electrical & Electronics Engineering Electronics & Communication Engineering General Knowledge Logical Reasoning Mechanical Engineering Non Verbal Reasoning Verbal Ability Verbal Reasoning

Interviews

HR Interview

Jobs

Sarkari Jobs

Results

Rojgar ResultSarkari Result

Admission

Admission 2022

Admit Card

Admit Card 2022

Answer Key

Answer Key 2022
copyright
Privacy Policy
© 2022 SarkariBix. All Rights Reserved.

Report