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?

Plot an objects, write a C code that plots an object on the window and on t...

write a C code that plots an object on the window and on the user''s click of mouse on the window, the object starts rotating continuously until the user presses the mouse again

Calculation, write a program to calculate the cuboid

write a program to calculate the cuboid

Linked list, program for singly linked list with out header

program for singly linked list with out header

Project, Project Overview A certain financial institution (bank) wishes to ...

Project Overview A certain financial institution (bank) wishes to promote its new business products/services by conducting road shows in rural areas. Their aim is to encourage peop

Change to palindrome, a palindrome is a string that reads the same from bho...

a palindrome is a string that reads the same from bhote the ends

Computer Science 101, This is what I need help with. "Create a program cre...

This is what I need help with. "Create a program creates an interface allowing the user to select from some other programs I have made one being a money converter and the other ca

Least coast method, Find out initial basic feasible solution for the given ...

Find out initial basic feasible solution for the given transportation problem using Least Cost Method (LCM).

Assignment, Programming Assignment # 1 C and UNIX   The purpose of this ...

Programming Assignment # 1 C and UNIX   The purpose of this assignment is to get you more familiar with Unix/Linux and those constructs of C that are not part of C++. Write a C

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