Ver Mensaje Individual
  #10 (permalink)  
Antiguo 09/10/2003, 06:37
Avatar de kapachov
kapachov
 
Fecha de Ingreso: diciembre-2002
Ubicación: Loeches
Mensajes: 464
Antigüedad: 21 años, 11 meses
Puntos: 0
/*
[#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...!!
__________________
Siempre hago lo que quiero...
Aunque no quiera...

Última edición por kapachov; 09/10/2003 a las 07:00