expected constructor, destructor, or type conversion before ‘(’ token|

1 #include <iostream>
 2 #include <stdio.h>
 3 using namespace std;
 4 
 5 int f()
 6 {
 7     cout<<"hello world"<<endl;
 8     return 4;
 9 };
10 //cout<<"hello world"<<endl;
11 printf("hello world\n");
12 int s = f();
13 
14 int main()
15 {
16     return 0;
17 }

11行错误!

C++中,全局域只能声明,初始化变量,不能对变量进行赋值,运算,调用函数等操作。
原文链接: https://www.cnblogs.com/linge1949/archive/2012/12/03/2800245.html

欢迎关注

微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍

原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/71390

非原创文章文中已经注明原地址,如有侵权,联系删除

关注公众号【高性能架构探索】,第一时间获取最新文章

转载文章受原作者版权保护。转载请注明原作者出处!

(0)
上一篇 2023年2月9日 下午2:47
下一篇 2023年2月9日 下午2:47

相关推荐