From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1014db,6abe66868c0ab0b1 X-Google-Attributes: gid1014db,public X-Google-Thread: 1164f8,6abe66868c0ab0b1 X-Google-Attributes: gid1164f8,public From: dqua@earthlink.net (Derick J.R. Qua-Gonzalez) Subject: Re: Help in computing time.... Date: 1995/06/21 Message-ID: #1/1 X-Deja-AN: 104873794 distribution: inet references: <3s884v$7qj@hermes.acs.unt.edu> organization: Earthlink Network, Inc. keywords: time, cc, gcc, ALPHA newsgroups: comp.lang.c,comp.sys.dec sarkar@ponder.csci.unt.edu (Falguni Sarkar) writes: >I am using a DEC Alpha machine. When I try to compile the >following code I am facing problems. >#include >#include >time_t tim1,*tp; >main(){ > tim1=time(tp); > if(tp==NULL) > printf("tp is NULL\n"); >} >If I use cc then tp is always returned as NULL. Mr. Sarkar, the problem stems from the fact that time() cannot modify the value of the pointer tp; it could only change the copy it has. The argument of time, if non-NULL, is where a the time value is stuffed, in addition to being returned, otherwise the argument is ignored completely. To get the time, either: time(&tim1); or: tim1=time(NULL); will work just fine and return the time to you in the variable tim1. >Thanks in advance, >Falguni Sarkar. Best regards, -- +----------------------------------------------------------------------------+ | Derick R. Qua-Gonzalez | ________ | | Department of High Energy Physics | \ / | | California State University | \ / | | dqua@Prometheus.EarthLink.Net | \ / | | | G \/ | +----------------------------------------------------------------------------+ | It is better to be hated for what one is, than loved for what one is not. | | (A. Gide) | +----------------------------------------------------------------------------+