Reputation: 29
#include <iostream>
#define hello()(printf("Hello");)
using namespace std;
void main()
{
hello();
}
i am using the following code which gives a compilation error !! what could be possibly wrong in this program !!
Upvotes: 1
Views: 49
Reputation: 225032
Parentheses can't be used to enclose statements. What you want is:
#define hello() printf("Hello");
The semicolon is also unnecessary, or maybe you meant:
#define hello() { printf("Hello"); }
Aside from that syntax error, you should probably include cstdio
to use printf
, and main
should return int
.
Upvotes: 2