goldshakil / ElectricalProgrammingCourse2020

This repository is aimed towards sharing and discussing issues about Electrical and Electronics Programming Course
6 stars 1 forks source link

Assignment 5 - Practice Session 3_#Q.6 #87

Open Jun-Github opened 4 years ago

Jun-Github commented 4 years ago

Thank you for quick reply. While coding my timer on Ptractice session 3 - Practice 6, I used these header and sleep() function as shown below

include

include

define _CRT_SECURE_NO_WARNINGS

int main(void){ int i; for(i = 0; i < 3; i++){ printf("Hello~!\n"); sleep(1); } return 0; }

What I notice is my time unit of sleep function is different from others. The time unit of my sleep function is in second; As I code sleep(10) , all tasks stop and waits for 10 seconds. But as I google about it I came to know that sleep function works for unit of millisecond.

Is there anything wrong about my windows, or mt IDE or compile(GNU GCC Complier), or am I missing something?

thank you.

goldshakil commented 4 years ago

The sleep function and Sleep function are differenet.

If you're running GCC compiler on linux it will use milliseconds. But if you're using a windows machine your code seems to be perfect.

Jun-Github commented 4 years ago

So the problem was difference between sleep and Sleep. Thank you.