Created
January 3, 2014 07:41
-
-
Save marcoscastro/8234327 to your computer and use it in GitHub Desktop.
Exemplo do uso de macros em C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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