Mudanças entre as edições de "Aula 16/06/15"
Ir para navegação
Ir para pesquisar
Linha 19: | Linha 19: | ||
printf ( "%dh%dmin%ds \n", tminfo->tm_hour, tminfo->tm_min, tminfo->tm_sec); | printf ( "%dh%dmin%ds \n", tminfo->tm_hour, tminfo->tm_min, tminfo->tm_sec); | ||
} | } | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | <syntaxhighlight lang=c> | ||
+ | int num; //nao usar mais para nao precisar usar mais pnum=# endereço do ponteiro | ||
+ | int *pnum; | ||
+ | pnum=malloc(); | ||
</syntaxhighlight> | </syntaxhighlight> |
Edição das 16h00min de 16 de junho de 2015
Aula 16/06/15
Trabalhando tempo em C
#include <stdio.h>
#include <time.h>
main()
{
time_t rawtime; // tipo de dados time_t
struct tm *tminfo;
time ( &rawtime );
tminfo = localtime ( &rawtime );
printf ( "hora: %d minuto: %d segundo: %d \n", tminfo->tm_hour, tminfo->tm_min, tminfo->tm_sec);
printf ( "%d:%d:%d \n", tminfo->tm_hour, tminfo->tm_min, tminfo->tm_sec);
printf ( "%dh%dmin%ds \n", tminfo->tm_hour, tminfo->tm_min, tminfo->tm_sec);
}
int num; //nao usar mais para nao precisar usar mais pnum=# endereço do ponteiro
int *pnum;
pnum=malloc();