小编ere*_*sgs的帖子

C 中的数组初始化 — “无法在赋值中将 '<brace-enclosed initializer list>' 转换为 'float'”错误

我正在尝试为我的模拟项目编译代码,并尝试初始化并表示我的rho数组,但遇到了初始化错误:

无法在赋值中将“大括号封闭的初始化列表”转换为“浮动”。

我需要分配rho[0]给数组的第一个成员等等。

#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <math.h>

int main()
{
    float lambda; // ratio of customers and time
    float N; // mean number of customers in the system
    float Q; // mean number of customers in queue
    float res_time; // response time
    float mu; // service rate , assuming mu = 10 customers/s for this assignment
    int i;
    float rho[10]; // array for rho values

    rho[10] = { 0.1, 0.4, 0.5, 0.6, …
Run Code Online (Sandbox Code Playgroud)

c arrays initialization

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

arrays ×1

c ×1

initialization ×1