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

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.