I'm trying to compile this code in C and it won't work. Can somebody help.
#include <stdio.h> void main() { int list[10] = {0}; for (int i=0; i<5; i++ ) list[2*i+1] = i+2; for (int i=0; i<10; i++ ) printf ("%3d", list[i]); } // main
The error happens when it gets to the "for" part.
oh fluttering apparently you can't fluttering do for(int i=0; .........) it needs to be for (i=0; ..........)
#include <stdio.h> void main() { int list[10] = {0}; for (int i=0; i<5; i++ ) list[2*i+1] = i+2; for (i=0; i<10; i++ ) printf ("%3d", list[i]); } // main --------------Problem Solved Now Compile the above program----------- Error in Code----> Multiple declaration for i in function main()
Thanks anoop27. I think it was my compiler. I used Dev C++ bloodshed. Apparently you can't do int i=0 inside a for loop with Dev C++ :/
@Fellowroot ur welcome
Join our real-time social learning platform and learn together with your friends!