M
MQ.john
//Working Example:
#include <stdio.h>
#include <time.h>
int main ()
{
time_t rawtime; /* define rawtime as time_t */
time ( &rawtime );
printf ( "Current date and time are: %s", ctime (&rawtime) ); /*call
ctime use &rawtime*/
return 0;
}
//Not Working Example:
#include <stdio.h>
#include <time.h>
int main ()
{
time_t *rawtime; /* define rawtime as pointer point to time_t */
time ( rawtime );
printf ( "Current date and time are: %s", ctime (rawtime) ); /* call
ctime use rawtime */
return 0;
}
it's very weird in the not working example. they are all pointer.
More example here.
char t_time;
read(fd, &t_time, 25); /* working */
char *t_time;
read(fd, t_time, 25); /* Not working */
Somebody help. i get more confuse on the pointer when i write program
in C. thank you.
#include <stdio.h>
#include <time.h>
int main ()
{
time_t rawtime; /* define rawtime as time_t */
time ( &rawtime );
printf ( "Current date and time are: %s", ctime (&rawtime) ); /*call
ctime use &rawtime*/
return 0;
}
//Not Working Example:
#include <stdio.h>
#include <time.h>
int main ()
{
time_t *rawtime; /* define rawtime as pointer point to time_t */
time ( rawtime );
printf ( "Current date and time are: %s", ctime (rawtime) ); /* call
ctime use rawtime */
return 0;
}
it's very weird in the not working example. they are all pointer.
More example here.
char t_time;
read(fd, &t_time, 25); /* working */
char *t_time;
read(fd, t_time, 25); /* Not working */
Somebody help. i get more confuse on the pointer when i write program
in C. thank you.