#include <iostream>
#define hello()(printf("Hello");)
using namespace std;
void main()
{
hello();
}
我正在使用以下代码,它给出了编译错误!这个程序可能有什么问题!
#include <iostream>
#define hello()(printf("Hello");)
using namespace std;
void main()
{
hello();
}
我正在使用以下代码,它给出了编译错误!这个程序可能有什么问题!
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
.