1
#include <iostream>
#define hello()(printf("Hello");)

using namespace std;

void main()
{
hello();
}

我正在使用以下代码,它给出了编译错误!这个程序可能有什么问题!

4

1 回答 1

2

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.

于 2013-08-15T05:00:04.130 回答