Reading floats into an array

后端 未结 6 795
[愿得一人]
[愿得一人] 2021-01-22 00:39

How could I read let\'s say 10 floats and store them in an array without wasting any memory?

6条回答
  •  说谎
    说谎 (楼主)
    2021-01-22 01:33

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

    As simple as it could be :)

提交回复
热议问题