函数定义到main()函数中。 [英] Function definition into main() function.
问题描述
您好,
以下代码是否符合ISO / IEC 9899:1999标准?
先谢谢,Vinicius。
#include< stdio.h>
#include< stdlib.h>
int main(void )
{
int a = 10;
void print()
{
printf(" a =%d \ n \ n",a);
}
print();
返回0;
}
Hello,
Is the code below obey the ISO/IEC 9899:1999?
Thanks in advance, Vinicius.
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int a = 10;
void print()
{
printf("a = %d\n\n", a);
}
print();
return 0;
}
推荐答案
CViniciusM< cv * *******@uol.com.br>潦草地写道:
CViniciusM <cv********@uol.com.br> scribbled the following:
你好,
下面的代码是否符合ISO / IEC 9899:1999?
No.
#include< stdio.h>
#include< stdlib.h>
int main(无效)
{a / 10;
void print()
{
printf(" a = %d \ n \ nn,a);
}
print();
返回0;
}
Hello, Is the code below obey the ISO/IEC 9899:1999?
No.
#include <stdio.h>
#include <stdlib.h> int main(void)
{
int a = 10;
void print()
{
printf("a = %d\n\n", a);
}
print(); return 0;
}
-
/ - Joona Palaste(pa ***** @ cc.helsinki.fi)-------------芬兰-------- \
\-- http://www.helsinki.fi/~palaste ------------ ---------规则! -------- /
我绝对的方面可能是......
- Mato Valtonen
--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"My absolute aspect is probably..."
- Mato Valtonen
CViniciusM写道:
CViniciusM wrote:
您好,
以下代码是否符合ISO / IEC 9899:1999?
提前致谢,Vinicius。
不,它不是ISO C.
ISO C不支持在体内定义的那种功能
a function"您已编码如下。
#include< stdio.h>
#include< stdlib.h>
int main(void)
{
int a = 10;
void print()
{/> printf(" a =%d \ nn \ n",a) ;
打印();
返回0;
}
Hello,
Is the code below obey the ISO/IEC 9899:1999?
Thanks in advance, Vinicius.
No, it isn''t ISO C.
ISO C does not support the sort of "function defined within the body of
a function" that you have coded below.
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int a = 10;
void print()
{
printf("a = %d\n\n", a);
}
print();
return 0;
}
-
Lew Pitcher,IT顾问,企业应用程序架构
企业技术解决方案,道明银行金融集团
(此处表达的意见是我自己的,而不是我的雇主'
--
Lew Pitcher, IT Consultant, Enterprise Application Architecture
Enterprise Technology Solutions, TD Bank Financial Group
(Opinions expressed here are my own, not my employer''s)
这篇关于函数定义到main()函数中。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!