c - This programming is compiling but not running. Where's the error? -
#include<stdio.h> void main() { int a[3]; a[0]=1; a[1]=2; a[2]=3; printf("%d", a[2]); } it isn't showing errors or warnings. isn't running
void main(){ is non-standard. main() function should return int. ides/platforms check return value of process. might problem. change to:
int main(void){ if using c89 should have return statement main(). not required since c99. in c99 , later, main() implicitly return success if control reaches end of main if had: return 0; @ end of main() function.
in c89/c90, must have return 0; or return exit_success; @ end of main(). otherwise, leads undefined behaviour. not required in c99 , c11. there's no other problem in code except this. if still have issues, need provide more details environment/compiler.
Comments
Post a Comment