c - 读入一个数组

标签 c floating-point floating-point-conversion

我如何读取比方说 10 个 float 并将它们存储在数组中而不浪费任何内存?

最佳答案

int size = 10;
float vet[size];
   for(i = 0; i < size; i++){
      scanf("%f", &vet[i]);
   }

越简单越好:)

关于c - 读入一个数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/843577/

相关文章:

c++ - 如何有效地比较包含 double 的 std::tuple 是否相等

c - 浮点乘法在 C 中的意外输出

c - C 中的 float

c++ - 将 4 个原始字节转换为 32 位 float

c++ - 数值结果超出范围

c - 变量值变化。

c - 如何修复“"Pointer being realloc' d 未分配”错误

c - ( float )类型转换不起作用

c - 在 C 中执行程序,不要等待它完成

c++ - Eiffel 工作室中的 "Unable to store the editor layout information."