I'm learning C. So I wrote this distance timer program. It runs well with gnu-gcc compiler. But but with gnu-gcc for avr it does compile but when I run it I get only a cmd session that does nothing except disappearing once I press any button. I want to know why.
I am using code blocks and here is my code
#include<stdio.h> #include<stdlib.h> #define speedpersecond 5 int main() { char time [5]; double distance; printf("Please enter time in seconds"); gets(time); distance = atoi(time) * speedpersecond; printf("Distance is %g ", distance); return 8585; }
gets. And why are you returning8585? Try returning 0