#ifndef UNICODE
#define UNICODE
#endif
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <Windows.h>
int main()
{
char buffer[30];
int counter=0;
for(int i=0; i<22 ; i++)
{
Sleep(1000);
printf("%d %d\n",counter++,time(0));
}
system("pause");
return 0;
}
This version works fine, it outputs counter and the timestamps of the last 22 seconds. Unfortunately, when I did seemingly extraneous thing - replacing counter and time(0) , that is printf("%d %d\n",time(0),counter++);
, function always printed 0 in place of counter! Any explanation of this strange fact?