answersLogoWhite

0


Best Answer

Declared is the right word. (Don't define functions in headers, unless you really know what you are doing.)

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Can an extern function be defined in a C header file?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Define header file with example.?

/* example.h */ #ifndef EXAMPLE_H #define EXAMPLE_H /* I'm a header file */ extern int example_variable; extern void example_function (void); typedef struct example_type { int unused; } example_type; #endif


Can static variables be declared in header file?

Can static variables be declared in a header file?You can't declare a static variable without defining it as well (this is because the storage class modifiersstatic and extern are mutually exclusive). A static variable can be defined in a header file, but this would cause each source file that included the header


How do you create a user defined header file?

Header files are not much different from usual cpp files. There are basically two different things. It's file extension: you need to choose "header file" when you create it or save as .h file. Second is header files do not have main() function. When you are done with you header file do not forger to include it in your project by writing preprocessor directive:#include "your_header_file.h"


In a header file whether functions are declared or defined?

Ideally, functions should only be declared in a header and defined in a translation unit (source file) that includes the header. However, trivial functions are often defined in a header as they are usually good candidates for inline expansion, but you must remember to declare the function inline. Often it is better to forward declare inline functions so that maintainers are not distracted by the implementation details which can be placed towards the end of the header, out of the way. However, a definition is also a declaration, so forward declaring an inline function is not a requirement unless there is a cyclic dependency issue where a forward declaration is necessary to break the cycle.


What are the header file of scanf function?

stdio.h


Which header file has clrscr function?

conio.h


Which header file must be included to use the function pow?

The std::pow() function can be found in the <cmath> header.


Is a header file a collection of built in functions that help in writing c programs?

No. There are no built-in functions in C, there are only built-in types and built-in operators for those types. All functions are user-defined, including those defined by the C standard library. There are no user-defined operators in C, but you can implement operators as named functions if required. A header file (*.h file) typically contains a group of related user-defined function and/or user-defined type declarations which can be included in any source file that requires them. Every user-defined function or user-defined type name used by a program must have one (and only one) definition, usually contained in a corresponding source file (*.c file) or library file (*.lib file). Built-in types and their corresponding operators do not require a header file since they are part of the language itself (hence they are built-in).


Can Header file be called in main function or not?

No, main.c does not require a header file. When you have a ".c" and ".h" pair, the ".h" file is to declare the existence of functions that are defined in the ".c" files so that these functions can be called in other files. since "main.c" needs the headers of the other modules (to access their data types and functions) but usually doesn't have a header file itself.Header files aren't "called", they are "included",but usually not inside any function.


What is the header file for string library function?

string.h


What is the function of keyword extern?

The extern keyword declares a variable or function and specifies that it has external linkage (its name is visible from files other than the one in which it's defined). When modifying a variable, extern specifies that the variable has static duration (it is allocated when the program begins and deallocated when the program ends). The variable or function may be defined in another source file, or later in the same file. Declarations of variables and functions at file scope are external by default. In C++, when used with a string, extern specifies that the linkage conventions of another language are being used for the declarator(s). C functions and data can be accessed only if they are previously declared as having C linkage. However, they must be defined in a separately compiled translation unit. Microsoft C++ supports the strings "C" and "C++" in the string-literal field. All of the standard include files use the extern "C" syntax to allow the run-time library functions to be used in C++ programs. If you find this info useful Please vote!!!


How can you make an header file in c language?

Using a text editor. Example: /* myheader.h */ #ifndef MYHEADER_H #define MYHEADER_H extern int myvariable; extern int myfunction (int x, int y, int z); #endif