Macro with variables - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Macro with variables

psppbpsppb Posts: 1Member
I am attempting to extend my knowledge of C and am working through a chapter on Macros. I am trying to create a macro that will return TRUE of the input is divisible by ten otherwise FALSE

Here is my code
[code]#include
#include
#include

/* Macro funcions*/
#define modulus(x) {if(x%10 == 0){printf("true
"); else printf("false
");}}




/* Declare variables*/
float centi;
float fahr;
char line[100];

int main()
{
int count = 12;
modulus(count);



system("pause"); /* the fix for the collapsing window*/
return (0);
}
[/code]

Something is wrong before the else statement in the macro and I cannot figure it out.

Thank you!
Sign In or Register to comment.