- Joined
- Jun 10, 2008
- Messages
- 1
- Reaction score
- 0
hi all, my code may be inefficient (which is fine for me right now), but its also doing something wrong, in a nutshell, here it is:
> #include <stdio.h>
> #include <stdlib.h>
>
> struct Structure1{
> float weeks;
> } step[10];
>
> void main(){
> step[].weeks = {1,2,3,4,5,6,7,8,9};
> }
the compiler is having issues with the second to last line where i try to assign values to each array of the structure at once. is there any way to do this besides going through each index individually (ie, step[0].weeks = 1; step[1].weeks = 2;...)?
-Jason
> #include <stdio.h>
> #include <stdlib.h>
>
> struct Structure1{
> float weeks;
> } step[10];
>
> void main(){
> step[].weeks = {1,2,3,4,5,6,7,8,9};
> }
the compiler is having issues with the second to last line where i try to assign values to each array of the structure at once. is there any way to do this besides going through each index individually (ie, step[0].weeks = 1; step[1].weeks = 2;...)?
-Jason