Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
99 views
in Information Technology by (95.2k points)
closed by

Assertion (A): If ‘char a[10];’ is defined in one file and ‘extern char *a;’ is declared in another file then it does not work.

Reason (R): The declaration ‘extern char *a;’ does not declare an array and therefore does not match the actual definition.


1. Both (A) and (R) are true and (R) is the correct explanation of (A)
2. Both (A) and (R) are true, but (R) is not the correct explanation of (A)
3. (A) is true, but (R) is false
4. (A) is false, but (R) is true

1 Answer

0 votes
by (95.4k points)
selected by
 
Best answer
Correct Answer - Option 1 : Both (A) and (R) are true and (R) is the correct explanation of (A)

extern:

extern keyword extends the function’s visibility to the whole program, the function can be called anywhere in any of the files of the whole program, provided those files contain a declaration of the function

extern char *a → is a pointer of type character with visibility to the whole program

Character array:

Character array declaration of size 10: char a[10]

Explanation:

If ‘char a[10];’ is defined in one file and ‘extern char *a;’ is declared in another file then it does not work. because the declaration ‘extern char *a;’ does not declare an array and therefore does not match the actual definition.

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...