Skip to content

Instantly share code, notes, and snippets.

@marcoscastro
Created January 3, 2014 07:41
Show Gist options
  • Save marcoscastro/8234327 to your computer and use it in GitHub Desktop.
Save marcoscastro/8234327 to your computer and use it in GitHub Desktop.
Exemplo do uso de macros em C
#include <stdio.h>
#define SOMA(x,y) ((x) + (y))
#define SUB(x,y) ((x) - (y))
#define DIV(x,y) ((x) / (y))
#define MULT(x,y) ((x) * (y))
int main()
{
printf("Soma: %d\n", SOMA(10, 5));
printf("Subtracao: %d\n", SUB(10, 5));
printf("Divisao: %d\n", DIV(10, 5));
printf("Multiplicacao: %d\n", MULT(10, 5));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment