What is difference among macro and template?, C/C++ Programming

Assignment Help:

A: In C++ there is a main difference among a template and a macro. Merely a macro is a string which the compiler replaces along with the value that was defined. For example #define STRING_TO_BE_REPLACED "ValueToReplaceWith"

A template is a method to make functions independent of data-types. It cannot be accomplished via macros.

For example a sorting function doesn't have to care whether it's sorting integers or letters as the same algorithm might apply anyway.

 


Related Discussions:- What is difference among macro and template?

''c'' programme, Write a ''C'' program to accept any 3 digit integer number...

Write a ''C'' program to accept any 3 digit integer number from the keyboard and display the word equivalent representation of the given number.

What does extern mean in a function declaration in c++, It tells the compil...

It tells the compiler that a variable or a function exists, even if the compiler hasn't yet seen it in the file presently being compiled. This variable or function may be distinct

Program, fine the class bankAccount to implement the basic properties of a ...

fine the class bankAccount to implement the basic properties of a bank account. An object of this class should store the following data: Account holder''s name (string), account nu

Program to show the ascii value of characters, Program to show the ascii va...

Program to show the ascii value of characters: int main() {                 int one_char;                 cout                 one_char = getch();

Code, how to write c++ for function f(x)= 2x^3 -x^2 +10

how to write c++ for function f(x)= 2x^3 -x^2 +10

Minimum shelf, how to find minimum number if shelves required

how to find minimum number if shelves required

Program is to define a class as library, Program is to define a class as li...

Program is to define a class as library: Program is to define a class as library and perform all the function of library management by using classes and object class librar

Looping, For Loop with inner loop

For Loop with inner loop

Want a scraping program created, Want a scraping program created Project...

Want a scraping program created Project Description: We need to hire a professional developer to scrape the site for information such as *product title *Product Price

Singly linked list, For this program you will add and test 2 new member fun...

For this program you will add and test 2 new member functions to the IntSLList class posted on the website. The two member functions are: insertByPosn(int el, int pos) Assuming t

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd