【发布时间】:2013-08-09 08:47:36
【问题描述】:
printf("The Volume of the cuboid with a height of%d", height);
printf("and width of%d\n", width);
printf("and depth of%d\n", depth);
printf("Gives you the Volume of %lf\n", vcuboid);
"volumeofcuboid.c:5: 错误:此处未声明“height”(不在函数中)volumeofcuboid.c:5:错误:此处未声明“width”(不在函数中)volumeofcuboid.c:5:错误:此处未声明“深度”(不在函数中)"
【问题讨论】:
-
你应该编译它......
-
将
#!/bin/bash放在开头可能无济于事。 -
天哪,这是大错特错。
vcuboid=((height*width*depth));不。 -
@KevinDTimm 我认为这会使编译器崩溃,编译器无法修复愚蠢的问题。
-
当您发布问题而不了解基础知识时,人们往往会有点刻薄,但我仍然记得当您是初学者时的感觉。去掉 shebang 行 (
#!/bin/bash) - 这是 shell 脚本语法,而不是 C。您需要使用gcc将其编译成可执行文件,然后您可以运行它。您所拥有的称为 C 源代码 - 您不能直接运行它。您还将vcuboid声明为一个函数,它应该是double(但您可以改用int)。