Jump to content
KAUFMANN

Erro simples em Vector de reais

Recommended Posts

KAUFMANN

#include <stdio.h>
#define T 10
int main(void){
    int i;
    float bolos[T];
    bolos[T]={1.2,0.9,0.7,1.6,1.3,0.9,1.2,1.1,1.0,1.4};
    for(i=0;i<T;i++){
                     printf("%f\n",bolos[i]);}
    system("pause");
    return 0;
}

Este código simples é suposto ser inicializado com aqueles valores, e depois imprimi-los.

No entanto, o código não é compilado porque devolve um erro de sintaxe, o qual não consigo identificar. Alguém têm alguma ideia do problema em mãos?

Share this post


Link to post
Share on other sites
MykeX

Estás a inicializar mal o vector.

Tenta:

float bolos[T]={1.2,0.9,0.7,1.6,1.3,0.9,1.2,1.1,1.0,1.4};

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.