answersLogoWhite

0


Best Answer

The c language does not have template functions. That is a c++ thing.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the differnce between ordinary function and template function of c language?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How will you overload a template function?

The only reason to overload a template function is to provide an overload that differs in the number and type of arguments that cannot be addressed by the template function alone. You simply declare them as you would any other overload. The overloads may themselves be template functions, but there must be no ambiguity: every template function must generate an unique function signature. Remember that template functions generate overloads at compile time on an as-required basis.


When to create a template function?

A template function is used when you want to write some kind of function that can be applied to different data types. It is a form of overloading, but you don't have to actually write all of the overloaded variants.


Distinguish between class template and template class?

Template class: A generic definition or a parametrized class not instantiated until the client provides the needed information. It?s jargon for plain templates. Class template: A class template specifies how individual classes can be constructed much like the way a class specifies how individual objects can be constructed. It?s jargon for plain classes. Class template is a template used to generate template classes. We cannot declare an object of a class template. Template class is an instance of a class template.


Where is the function declare in c plus plus language?

All function interfaces must be declared before they can be used. This is known as a forward declaration and is strictly enforced in C++ (but not in C). To facilitate this, interfaces are typically placed in a header file which can then be included in every source file that requires access to that function. The interface need not be defined (implemented) in the header unless the function is a template function. Typically, implementations are kept separate from interfaces (template function implementations are kept in the header but typically separated from the interface) since the interface contains everything the user needs to know in order to make use of the function.


What do you mean by Instantiating the function template?

Function templates are generic functions for which at least one argument must be a generic type. You cannot instantiate a generic type without knowing its actual type, so until you provide an actual type for the function, the function template cannot be instantiated. You provide an actual type simply by calling the function. If an unambiguous template exists, the compiler generates the actual function for you. At that point the function is said to have been instantiated, just as if you'd written the function by hand. If you call the function again with different types, then new instances of the function are instantiated to match those types, just as if you'd manually written the overloads yourself.

Related questions

How will you overload a template function?

The only reason to overload a template function is to provide an overload that differs in the number and type of arguments that cannot be addressed by the template function alone. You simply declare them as you would any other overload. The overloads may themselves be template functions, but there must be no ambiguity: every template function must generate an unique function signature. Remember that template functions generate overloads at compile time on an as-required basis.


When to create a template function?

A template function is used when you want to write some kind of function that can be applied to different data types. It is a form of overloading, but you don't have to actually write all of the overloaded variants.


When and how a c compiler generate actual function from its template?

At the point it is used.


How does a DNA molecule act as a template?

Template DNA is a DNA you want to amplify. So you should know what you are amplifying before a PCR or you can make it by sequencing your PCR product.


What is an important function of the non-sense strand?

it serves as template for RNA synthesize


Distinguish between class template and template class?

Template class: A generic definition or a parametrized class not instantiated until the client provides the needed information. It?s jargon for plain templates. Class template: A class template specifies how individual classes can be constructed much like the way a class specifies how individual objects can be constructed. It?s jargon for plain classes. Class template is a template used to generate template classes. We cannot declare an object of a class template. Template class is an instance of a class template.


Which type of document can be merged with a data source file?

A main document, which can be an ordinary Word document, such as a letter, or it could from a template.


Where is the function declare in c plus plus language?

All function interfaces must be declared before they can be used. This is known as a forward declaration and is strictly enforced in C++ (but not in C). To facilitate this, interfaces are typically placed in a header file which can then be included in every source file that requires access to that function. The interface need not be defined (implemented) in the header unless the function is a template function. Typically, implementations are kept separate from interfaces (template function implementations are kept in the header but typically separated from the interface) since the interface contains everything the user needs to know in order to make use of the function.


What is difference between template and inline functions?

Template function would be global, they would have effect on all the pages within the template. Inline, would be regarding a specific line of code within a table or Div tag.


How do you say template in spanish?

The way that you say "template" in the Spanish language is by saying "la plantilla". A template is a form that is used that will help a person complete a task more quickly (especially one that they will be dong over and over).


What do you mean by Instantiating the function template?

Function templates are generic functions for which at least one argument must be a generic type. You cannot instantiate a generic type without knowing its actual type, so until you provide an actual type for the function, the function template cannot be instantiated. You provide an actual type simply by calling the function. If an unambiguous template exists, the compiler generates the actual function for you. At that point the function is said to have been instantiated, just as if you'd written the function by hand. If you call the function again with different types, then new instances of the function are instantiated to match those types, just as if you'd manually written the overloads yourself.


What Computer language acronym ends -T-L?

STL Standard Template Library