Perchè stampa sempre lo stesso valore????
codice:# include <stdio.h> # include <time.h> main(){ int s_hour, s_minutes, s_second, e_hour, e_minutes, e_second,i; struct tm * start = (struct tm*)malloc(sizeof(struct tm)); struct tm * end = (struct tm*)malloc(sizeof(struct tm)); double total; time_t start_t, end_t; printf("Inserire ore, minuti e secondi"); scanf("%d",&s_hour); scanf("%d",&s_minutes); scanf("%d",&s_second); printf("Inserire ore, minuti e secondi"); scanf("%d",&e_hour); scanf("%d",&e_minutes); scanf("%d",&e_second); start->tm_hour=s_hour; start->tm_min=s_minutes; start->tm_sec=s_second; end->tm_hour=e_hour; end->tm_min=e_minutes; end->tm_sec=e_second; start_t= mktime(start); end_t=mktime(end); total= difftime(end_t,start_t); printf("I secondi sono:"); printf("%d", &total); scanf("%d", &i); }![]()


Rispondi quotando
