This program is not running , there is an error:
/* gmtime example */
#include %26lt;stdio.h%26gt;
#include %26lt;time.h%26gt;
#define MST (-7)
#define UTC (0)
#define CCT (+8)
int main ()
{
time_t rawtime;
tm * ptm;
time ( %26amp;rawtime );
ptm = gmtime ( %26amp;rawtime );
puts ("Current time around the World:");
printf ("Phoenix, AZ (U.S.) : %2d:%02d\n", (ptm-%26gt;tm_hour+MST)%24, ptm-%26gt;tm_min);
printf ("Reykjavik (Iceland) : %2d:%02d\n", (ptm-%26gt;tm_hour+UTC)%24, ptm-%26gt;tm_min);
printf ("Beijing (China) : %2d:%02d\n", (ptm-%26gt;tm_hour+CCT)%24, ptm-%26gt;tm_min);
return 0;
}
it says undefined symbol 'tm'
and undefined symbol 'ptm'
Turbo C help?
just use time_t or time in place of tm in second line in main function
Reply:You need to declare the variables in your program inside the main() function.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment