计算立方体的体积

标签 c linux

 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:错误:此处未声明“深度”(不在函数中)“

最佳答案

对于初学者:

  1. #!/bin/bash

C 不是 shell 脚本。即使您使用的是 cshell,也不会。

  1. vcuboid(高度、宽度、深度);

不是有效的函数原型(prototype),并且您从未提供实际的函数。

  1. main()

不是 main() 的有效定义,应该是 int main(void)

  1. vcuboid=((高*宽*深));

vcuboid 尚未定义。

只是,不。

  1. 退出(0);

返回0;

关于计算立方体的体积,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18112480/

相关文章:

c - getchar_unlocked() 解释

c - 错误 : expected '=' , ',' 、 ';' 、 'asm' 或 '__attribute__' 在 '->' token 之前,我是否错过了该行之前的内容?

linux - 在 makefile 中检查 java 版本

linux - 想要一个2.6.38以上内核版本使用aes加密方式的例子

c++ - 将缓冲区写入文本文件

c - 寻找复制到缓冲区的字符串

python - 从 Python 和 sh 模块运行命令时,LXD 容器上的百万次关闭系统调用

linux - BASH: "export k=1"与 "k=1"之间的区别

linux - awk 和特殊括号定界符

c - __security_init_cookie 和 PI