Write a C program to demonstrate working of difftime()

0

Here is an example C program that demonstrates the use of the difftime() function:


When you run this program, it will output:

 

In this program, we first use the time() function to get the current time and store it in the variable now. Then we add 60 seconds to the current time to get a time that is 60 seconds later and store it in the variable later. Next, we use the difftime() function to calculate the difference between these two times in seconds. Finally, we use the printf() function to display the result on the screen.


You can change the value of later as per your requirement and check the difference again.

Post a Comment

0Comments
Post a Comment (0)