这个程序有意义吗? [英] Does this program make any sense?

查看:69
本文介绍了这个程序有意义吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用g ++ / gcc 3.3.1和MS Visual C ++

6编译了以下程序。它运行没有任何错误。这件事有意义吗?是某些使用的
还是c / c ++语法/ CFG的一些问题?


#include< stdio.h>

int func()

{

int x;

返回x,x;

}


int main()

{

int a,b;

a,b,a;

printf("%d",func);

返回(a,b);

}

问候,

Rabeeh。

I have compiled following program with g++/gcc 3.3.1 and "MS Visual C++
6" and it ran without any errors. Does this thing make any sense? Is it
of some use or some problem with grammar/CFG of c/c++?

#include <stdio.h>
int func()
{
int x;
return x,x;
}

int main()
{
int a,b;
a,b,a;
printf("%d",func);
return (a,b);
}
Regards,
Rabeeh.

推荐答案



" centurian"写道:

"centurian" wrote:
我用g ++ / gcc 3.3.1和MS Visual C ++
6编译了以下程序。它运行没有任何错误。这件事有意义吗?是否有某些用途或c / c ++语法/ CFG的某些问题?

#include< stdio.h>
int func()
{
int x;
返回x,x;
}
int main()
{
int a,b;
a,b,a;
printf("%d",func);
返回(a,b);
}
I have compiled following program with g++/gcc 3.3.1 and "MS Visual C++
6" and it ran without any errors. Does this thing make any sense? Is it
of some use or some problem with grammar/CFG of c/c++?

#include <stdio.h>
int func()
{
int x;
return x,x;
}

int main()
{
int a,b;
a,b,a;
printf("%d",func);
return (a,b);
}




您确定:


printf("%d",func);


不应该是


printf("%d",func());


??


如果所以,它是合法的,但它没有任何用处...


John



Are you sure:

printf("%d",func);

shouldn''t be

printf("%d",func());

??

If so, it is legal, but it does not serve any useful purpose...

John


centurian写道:
centurian wrote:
我用g ++ / gcc 3.3.1和MS Visual C ++
6编译了以下程序。它运行没有任何错误。这件事有意义吗?是否有某些用途或c / c ++语法/ CFG的某些问题?

#include< stdio.h>
int func()
{
int x;
返回x,x;
}
int main()
{
int a,b;
a,b,a;
printf("%d",func);
返回(a,b);
}
I have compiled following program with g++/gcc 3.3.1 and "MS Visual C++
6" and it ran without any errors. Does this thing make any sense? Is it
of some use or some problem with grammar/CFG of c/c++?

#include <stdio.h>
int func()
{
int x;
return x,x;
}

int main()
{
int a,b;
a,b,a;
printf("%d",func);
return (a,b);
}




阅读逗号操作员。


- J.



Read up on "comma operator".

- J.


文章< 11 ** ********************@f14g2000cwb.googlegroups .com> ;,

" centurian" < RA *********** @ gmail.com>写道:
In article <11**********************@f14g2000cwb.googlegroups .com>,
"centurian" <ra***********@gmail.com> wrote:
我用g ++ / gcc 3.3.1和MS Visual C ++
6编译了以下程序。它运行没有任何错误。这件事有意义吗?是否有某些用途或c / c ++语法/ CFG的某些问题?

#include< stdio.h>
int func()
{
int x;
返回x,x;
}
int main()
{
int a,b;
a,b,a;
printf("%d",func);
返回(a,b);
}
I have compiled following program with g++/gcc 3.3.1 and "MS Visual C++
6" and it ran without any errors. Does this thing make any sense? Is it
of some use or some problem with grammar/CFG of c/c++?

#include <stdio.h>
int func()
{
int x;
return x,x;
}

int main()
{
int a,b;
a,b,a;
printf("%d",func);
return (a,b);
}




我最近指责某人使用逗号运算符来避免使用'if'语句中的括号

。他做了:


如果(条件)表达式1,表达式2;


我没有留下深刻的印象。


-

魔术取决于传统和信仰。它不欢迎观察,

也不会通过实验获利。另一方面,科学的经验基于
;它可以通过观察和实验进行校正。



I recently berated someone for using the comma operator to avoid braces
in an ''if'' statement. He did:

if ( condition ) expression1, expression2;

I was not impressed.

--
Magic depends on tradition and belief. It does not welcome observation,
nor does it profit by experiment. On the other hand, science is based
on experience; it is open to correction by observation and experiment.


这篇关于这个程序有意义吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆