Site icon T4Tutorials.com

Difference between macro and function

Difference between macro and function
#define Message "Welcome to"
#define SITE "T4Tutorials.com"
#define YEAR 2020
#include <iostream>
using namespace std ;

int main()
{
	cout << Message << endl << SITE << endl;
	cout << endl << "YEAR is: " << YEAR ;
	cout << endl << "Next YEAR is: " << ((YEAR)+1) << endl ;

	return 0 ;
}

Output

Welcome to

T4Tutorials.com

YEAR is: 2020

Next YEAR is: 2021

Exit mobile version