Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  What is the meaning of using extern before fu... Start Learning for Free
What is the meaning of using extern before function declaration? For example following function sum is made extern
extern int sum(int x, int y, int z)
{
    return (x + y + z);
}
  • a)
    Function is made globally available
  • b)
    extern means nothing, sum() is same without extern keyword.
  • c)
    Function need not to be declared before its use
  • d)
    Function is made local to the file
Correct answer is option 'B'. Can you explain this answer?
Most Upvoted Answer
What is the meaning of using extern before function declaration? For e...
extern keyword is used for global variables. Functions are global anyways, so adding extern doesn't add anything.
Free Test
Community Answer
What is the meaning of using extern before function declaration? For e...
The answer to this question is option 'B' - extern means nothing, sum() is the same without the extern keyword.

When the extern keyword is used before a function declaration, it indicates that the function is defined in a different file. It tells the compiler that the function is declared elsewhere and its definition will be provided at link time.

Here is a detailed explanation of the answer:

1. The extern keyword:
The extern keyword is used to declare a variable or a function that is defined in a separate file or module. It allows the program to use the variable or function even if it is defined in a different source file.

2. Function declaration:
A function declaration is a statement that describes the types of parameters a function accepts and the type of value it returns. It provides the necessary information to the compiler about the function's name, return type, and parameters.

3. The purpose of extern before a function declaration:
When the extern keyword is used before a function declaration, it tells the compiler that the function is defined in a different file. This means that the function's definition will be provided at link time when all the separate object files are combined to create the final executable.

4. The significance of extern in the given example:
In the given example, the function sum() is declared with the extern keyword. This indicates that the function is defined in a different file and its definition will be linked later. However, since the function definition is not provided in the given code snippet, it is not possible to determine the exact behavior or functionality of the sum() function.

5. The absence of extern:
If the extern keyword is not used before the function declaration, it means that the function is defined within the same file. In this case, the function's definition must be present in the same file, either before or after its usage.

In conclusion, when the extern keyword is used before a function declaration, it indicates that the function is defined in a different file. However, in the given example, since the function definition is not provided, the extern keyword has no impact on the function's behavior.
Explore Courses for Computer Science Engineering (CSE) exam

Similar Computer Science Engineering (CSE) Doubts

Top Courses for Computer Science Engineering (CSE)

What is the meaning of using extern before function declaration? For example following function sum is made externextern int sum(int x, int y, int z){ return (x + y + z);}a)Function is made globally availableb)extern means nothing, sum() is same without extern keyword.c)Function need not to be declared before its used)Function is made local to the fileCorrect answer is option 'B'. Can you explain this answer?
Question Description
What is the meaning of using extern before function declaration? For example following function sum is made externextern int sum(int x, int y, int z){ return (x + y + z);}a)Function is made globally availableb)extern means nothing, sum() is same without extern keyword.c)Function need not to be declared before its used)Function is made local to the fileCorrect answer is option 'B'. Can you explain this answer? for Computer Science Engineering (CSE) 2024 is part of Computer Science Engineering (CSE) preparation. The Question and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus. Information about What is the meaning of using extern before function declaration? For example following function sum is made externextern int sum(int x, int y, int z){ return (x + y + z);}a)Function is made globally availableb)extern means nothing, sum() is same without extern keyword.c)Function need not to be declared before its used)Function is made local to the fileCorrect answer is option 'B'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2024 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for What is the meaning of using extern before function declaration? For example following function sum is made externextern int sum(int x, int y, int z){ return (x + y + z);}a)Function is made globally availableb)extern means nothing, sum() is same without extern keyword.c)Function need not to be declared before its used)Function is made local to the fileCorrect answer is option 'B'. Can you explain this answer?.
Solutions for What is the meaning of using extern before function declaration? For example following function sum is made externextern int sum(int x, int y, int z){ return (x + y + z);}a)Function is made globally availableb)extern means nothing, sum() is same without extern keyword.c)Function need not to be declared before its used)Function is made local to the fileCorrect answer is option 'B'. Can you explain this answer? in English & in Hindi are available as part of our courses for Computer Science Engineering (CSE). Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free.
Here you can find the meaning of What is the meaning of using extern before function declaration? For example following function sum is made externextern int sum(int x, int y, int z){ return (x + y + z);}a)Function is made globally availableb)extern means nothing, sum() is same without extern keyword.c)Function need not to be declared before its used)Function is made local to the fileCorrect answer is option 'B'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of What is the meaning of using extern before function declaration? For example following function sum is made externextern int sum(int x, int y, int z){ return (x + y + z);}a)Function is made globally availableb)extern means nothing, sum() is same without extern keyword.c)Function need not to be declared before its used)Function is made local to the fileCorrect answer is option 'B'. Can you explain this answer?, a detailed solution for What is the meaning of using extern before function declaration? For example following function sum is made externextern int sum(int x, int y, int z){ return (x + y + z);}a)Function is made globally availableb)extern means nothing, sum() is same without extern keyword.c)Function need not to be declared before its used)Function is made local to the fileCorrect answer is option 'B'. Can you explain this answer? has been provided alongside types of What is the meaning of using extern before function declaration? For example following function sum is made externextern int sum(int x, int y, int z){ return (x + y + z);}a)Function is made globally availableb)extern means nothing, sum() is same without extern keyword.c)Function need not to be declared before its used)Function is made local to the fileCorrect answer is option 'B'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice What is the meaning of using extern before function declaration? For example following function sum is made externextern int sum(int x, int y, int z){ return (x + y + z);}a)Function is made globally availableb)extern means nothing, sum() is same without extern keyword.c)Function need not to be declared before its used)Function is made local to the fileCorrect answer is option 'B'. Can you explain this answer? tests, examples and also practice Computer Science Engineering (CSE) tests.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev