/*
[#4] EXAMPLE 2 The following defines a function-like macro
whose value is the maximum of its arguments. It has the
advantages of working for any compatible types of the
arguments and of generating in-line code without the
overhead of function calling. It has the disadvantages of
evaluating one or the other of its arguments a second time
(including side effects) and generating more code than a
function if invoked several times. It also cannot have its
address taken, as it has none.
#define max(a, b) ((a) > (b) ? (a) : (b))
The parentheses ensure that the arguments and the resulting
expression are bound properly.
*/
#include <stdio.h>
#define max(a, b) ((a) > (b) ? (a) : (b))
int const CONS=10 ;
main()
{
int i;
i = max(20, CONS);
printf("El mayor de %d y %d es %d\n", 20, CONS, i);
}
Holassss .... funca!!!
---------------------
El error esta en el #define CONS=10...
pues no se hace de esta forma!
se hace asi!!
#define CONS 10
y funca...!!