KAUFMANN 0 Posted February 17, 2011 Report Share Posted February 17, 2011 #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? Link to post Share on other sites
MykeX 0 Posted February 17, 2011 Report Share Posted February 17, 2011 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}; Link to post Share on other sites
KAUFMANN 0 Posted February 17, 2011 Author Report Share Posted February 17, 2011 Claro. Era precisamente esse o erro. Obrigado! Link to post Share on other sites
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now