A PHP Error was encountered

Severity: 8192

Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

Filename: libraries/Filtered_db.php

Line Number: 23

Print argument (i.e. variable name, value) using Macro in C
Q:

Print argument (i.e. variable name, value) using Macro in C

0

Print argument (i.e. variable name, value) using Macro in C

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Example:

#include <stdio.h>

#define SQUARE(N)	printf("Square of " #N " is = %d\n",(N*N))
#define CUBE(N)		printf("Cube   of " #N " is = %d\n",(N*N*N))

int main()
{
	int number = 10;
	
	//passing variable name 
	SQUARE(number);
	CUBE(number);
	
	//passing values
	SQUARE(10);
	CUBE(10);

	return 0;
}

Output

    Square of number is = 100
    Cube   of number is = 1000
    Square of 10 is = 100
    Cube   of 10 is = 1000

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now