Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #157771 > unrolled thread

what is a & ?

Started byT <T@invalid.invalid>
First post2020-12-25 19:31 -0800
Last post2021-01-28 11:02 -0600
Articles 20 — 9 participants

Back to article view | Back to comp.lang.c


Contents

  what is a & ? T <T@invalid.invalid> - 2020-12-25 19:31 -0800
    Re: what is a & ? fir <profesor.fir@gmail.com> - 2020-12-25 21:11 -0800
      Re: what is a & ? T <T@invalid.invalid> - 2020-12-25 21:37 -0800
    Re: what is a & ? "wolfgang bauer (D)" <schutz@gmx.de> - 2020-12-26 06:15 +0100
      Re: what is a & ? T <T@invalid.invalid> - 2020-12-25 21:37 -0800
    Re: what is a & ? scott@slp53.sl.home (Scott Lurndal) - 2020-12-26 16:31 +0000
      Re: what is a & ? T <T@invalid.invalid> - 2020-12-26 18:28 -0800
        Re: what is a & ? Bart <bc@freeuk.com> - 2020-12-27 12:31 +0000
          Re: what is a & ? David Brown <david.brown@hesbynett.no> - 2020-12-27 15:32 +0100
            Re: what is a & ? Bart <bc@freeuk.com> - 2020-12-27 14:53 +0000
              Re: what is a & ? David Brown <david.brown@hesbynett.no> - 2020-12-27 16:40 +0100
          Re: what is a & ? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-12-27 12:03 -0800
            Re: what is a & ? Bart <bc@freeuk.com> - 2020-12-27 20:33 +0000
          Re: what is a & ? T <T@invalid.invalid> - 2020-12-27 17:43 -0800
            Re: what is a & ? David Brown <david.brown@hesbynett.no> - 2020-12-28 11:00 +0100
            Re: what is a & ? Bart <bc@freeuk.com> - 2020-12-28 11:16 +0000
          Re: what is a & ? T <T@invalid.invalid> - 2020-12-27 20:36 -0800
            Re: what is a & ? T <T@invalid.invalid> - 2020-12-27 20:48 -0800
      Re: what is a & ? Bonita Montero <Bonita.Montero@gmail.com> - 2020-12-27 18:30 +0100
    Re: what is a & ? John Bode <jfbode1029@gmail.com> - 2021-01-28 11:02 -0600

#157771 — what is a & ?

FromT <T@invalid.invalid>
Date2020-12-25 19:31 -0800
Subjectwhat is a & ?
Message-ID<rs6ar2$7nj$1@dont-email.me>
Hi All,

I the following code, I do beleive I hae everything
figured out, except for "&rawtime". It looks like it
is a time_t (long long integer or 64 bit integer).
What does the "&" do to the variable?


https://www.cplusplus.com/reference/ctime/localtime/

/* localtime example */
#include <stdio.h>      /* puts, printf */
#include <time.h>       /* time_t, struct tm, time, localtime */

int main ()
{
   time_t rawtime;
   struct tm * timeinfo;

   time (&rawtime);
   timeinfo = localtime (&rawtime);
   printf ("Current local time and date: %s", asctime(timeinfo));

   return 0;
}



Many thanks,
-T

[toc] | [next] | [standalone]


#157773

Fromfir <profesor.fir@gmail.com>
Date2020-12-25 21:11 -0800
Message-ID<1d424f4e-6993-4048-bcc6-76e24577f9cen@googlegroups.com>
In reply to#157771
sobota, 26 grudnia 2020 o 04:32:01 UTC+1 T napisał(a):
> Hi All, 
> 
> I the following code, I do beleive I hae everything 
> figured out, except for "&rawtime". It looks like it 
> is a time_t (long long integer or 64 bit integer). 
> What does the "&" do to the variable? 
> 
> 
> https://www.cplusplus.com/reference/ctime/localtime/ 
> 
> /* localtime example */ 
> #include <stdio.h> /* puts, printf */ 
> #include <time.h> /* time_t, struct tm, time, localtime */ 
> 
> int main () 
> { 
> time_t rawtime; 
> struct tm * timeinfo; 
> 
> time (&rawtime); 
> timeinfo = localtime (&rawtime); 
> printf ("Current local time and date: %s", asctime(timeinfo)); 
> 
> return 0; 
> } 
> 
it is an adress of emory location when rawtime is placed, on 32 bit machines this adres is a size or 4 bytes and is something like 0x00403000, its often more effective than passing by value

[toc] | [prev] | [next] | [standalone]


#157776

FromT <T@invalid.invalid>
Date2020-12-25 21:37 -0800
Message-ID<rs6i7k$9ou$2@dont-email.me>
In reply to#157773
On 12/25/20 9:11 PM, fir wrote:
> sobota, 26 grudnia 2020 o 04:32:01 UTC+1 T napisał(a):
>> Hi All,
>>
>> I the following code, I do beleive I hae everything
>> figured out, except for "&rawtime". It looks like it
>> is a time_t (long long integer or 64 bit integer).
>> What does the "&" do to the variable?
>>
>>
>> https://www.cplusplus.com/reference/ctime/localtime/
>>
>> /* localtime example */
>> #include <stdio.h> /* puts, printf */
>> #include <time.h> /* time_t, struct tm, time, localtime */
>>
>> int main ()
>> {
>> time_t rawtime;
>> struct tm * timeinfo;
>>
>> time (&rawtime);
>> timeinfo = localtime (&rawtime);
>> printf ("Current local time and date: %s", asctime(timeinfo));
>>
>> return 0;
>> }
>>
> it is an adress of emory location when rawtime is placed, on 32 bit machines this adres is a size or 4 bytes and is something like 0x00403000, its often more effective than passing by value
> 


Now it makes sense.  Thank you!

[toc] | [prev] | [next] | [standalone]


#157774

From"wolfgang bauer (D)" <schutz@gmx.de>
Date2020-12-26 06:15 +0100
Message-ID<rs6gte$40i$1@dont-email.me>
In reply to#157771
26.12.20 , 04:31 , T:

> I the following code, I do beleive I hae everything
> figured out, except for "&rawtime". It looks like it
> is a time_t (long long integer or 64 bit integer).
> What does the "&" do to the variable?
> 
> 

>   time_t rawtime;
>   struct tm * timeinfo;
> 
>   time (&rawtime);


The "&" gives the Memory-Address. So &rawtime is equal to the location of rawtime in the RAM.

 


-- 
Gruß, Greetings

[toc] | [prev] | [next] | [standalone]


#157775

FromT <T@invalid.invalid>
Date2020-12-25 21:37 -0800
Message-ID<rs6i7b$9ou$1@dont-email.me>
In reply to#157774
On 12/25/20 9:15 PM, wolfgang bauer (D) wrote:
> 26.12.20 , 04:31 , T:
> 
>> I the following code, I do beleive I hae everything
>> figured out, except for "&rawtime". It looks like it
>> is a time_t (long long integer or 64 bit integer).
>> What does the "&" do to the variable?
>>
>>
> 
>>    time_t rawtime;
>>    struct tm * timeinfo;
>>
>>    time (&rawtime);
> 
> 
> The "&" gives the Memory-Address. So &rawtime is equal to the location of rawtime in the RAM.
> 
>   
> 
> 

Now it makes sense.  Thank you!

[toc] | [prev] | [next] | [standalone]


#157791

Fromscott@slp53.sl.home (Scott Lurndal)
Date2020-12-26 16:31 +0000
Message-ID<VzJFH.47724$192.7926@fx47.iad>
In reply to#157771
T <T@invalid.invalid> writes:
>Hi All,
>
>I the following code, I do beleive I hae everything
>figured out, except for "&rawtime". It looks like it
>is a time_t (long long integer or 64 bit integer).
>What does the "&" do to the variable?

https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B

[toc] | [prev] | [next] | [standalone]


#157802

FromT <T@invalid.invalid>
Date2020-12-26 18:28 -0800
Message-ID<rs8rgi$bce$1@dont-email.me>
In reply to#157791
On 12/26/20 8:31 AM, Scott Lurndal wrote:
> T <T@invalid.invalid> writes:
>> Hi All,
>>
>> I the following code, I do beleive I hae everything
>> figured out, except for "&rawtime". It looks like it
>> is a time_t (long long integer or 64 bit integer).
>> What does the "&" do to the variable?
> 
> https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B
> 

Awesome!  Thank you!  I am going to save the list
in my documentation.

[toc] | [prev] | [next] | [standalone]


#157811

FromBart <bc@freeuk.com>
Date2020-12-27 12:31 +0000
Message-ID<_8%FH.596024$b5kb.105900@fx15.ams4>
In reply to#157802
On 27/12/2020 02:28, T wrote:
 > On 12/26/20 8:31 AM, Scott Lurndal wrote:
 >> T <T@invalid.invalid> writes:
 >>> Hi All,
 >>>
 >>> I the following code, I do beleive I hae everything
 >>> figured out, except for "&rawtime". It looks like it
 >>> is a time_t (long long integer or 64 bit integer).
 >>> What does the "&" do to the variable?
 >>
 >> https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B
 >>
 >
 > Awesome!  Thank you!  I am going to save the list
 > in my documentation.

Take care because that list seems be primarily for C++, although many 
operators are shared.

In C++, & is also used in parameter lists to indicate reference parameters.

But, I've just had a look at this: 
https://docs.raku.org/language/operators. That makes C++ look simple!

[toc] | [prev] | [next] | [standalone]


#157819

FromDavid Brown <david.brown@hesbynett.no>
Date2020-12-27 15:32 +0100
Message-ID<rsa5t6$fkl$1@dont-email.me>
In reply to#157811
On 27/12/2020 13:31, Bart wrote:
> On 27/12/2020 02:28, T wrote:
>> On 12/26/20 8:31 AM, Scott Lurndal wrote:
>>> T <T@invalid.invalid> writes:
>>>> Hi All,
>>>>
>>>> I the following code, I do beleive I hae everything
>>>> figured out, except for "&rawtime". It looks like it
>>>> is a time_t (long long integer or 64 bit integer).
>>>> What does the "&" do to the variable?
>>>
>>> https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B
>>>
>>
>> Awesome!  Thank you!  I am going to save the list
>> in my documentation.
> 
> Take care because that list seems be primarily for C++, although many
> operators are shared.
> 

Another good source of documentation on C is:

<https://en.cppreference.com/w/c>

with the operator summary here:

<https://en.cppreference.com/w/c/language/expressions#Operators>


That site also covers C++, but it keeps the languages separate.  It is
accurate, and tracks the latest standards and proposals (and makes the
differences clear).

[toc] | [prev] | [next] | [standalone]


#157820

FromBart <bc@freeuk.com>
Date2020-12-27 14:53 +0000
Message-ID<Zd1GH.192592$9X39.12027@fx26.ams4>
In reply to#157819
On 27/12/2020 14:32, David Brown wrote:
> On 27/12/2020 13:31, Bart wrote:

>> Take care because that list seems be primarily for C++, although many
>> operators are shared.
>>
> 
> Another good source of documentation on C is:
> 
> <https://en.cppreference.com/w/c>
> 
> with the operator summary here:
> 
> <https://en.cppreference.com/w/c/language/expressions#Operators>

I looked at this out of interest, but it is that that clear.

It groups unary & under 'member access' (along with unary *, and [] 
indexing, none of which is anything to do with accessing a struct member).

I'd imagine that would do little to clarify it for the OP.

(It also classes bitwise ops as 'arithmetic', which some languages 
strive to keep separate.)

[toc] | [prev] | [next] | [standalone]


#157821

FromDavid Brown <david.brown@hesbynett.no>
Date2020-12-27 16:40 +0100
Message-ID<rsa9tf$c58$1@dont-email.me>
In reply to#157820
On 27/12/2020 15:53, Bart wrote:
> On 27/12/2020 14:32, David Brown wrote:
>> On 27/12/2020 13:31, Bart wrote:
> 
>>> Take care because that list seems be primarily for C++, although many
>>> operators are shared.
>>>
>>
>> Another good source of documentation on C is:
>>
>> <https://en.cppreference.com/w/c>
>>
>> with the operator summary here:
>>
>> <https://en.cppreference.com/w/c/language/expressions#Operators>
> 
> I looked at this out of interest, but it is that that clear.
> 
> It groups unary & under 'member access' (along with unary *, and []
> indexing, none of which is anything to do with accessing a struct member).
> 
> I'd imagine that would do little to clarify it for the OP.
> 
> (It also classes bitwise ops as 'arithmetic', which some languages
> strive to keep separate.)
> 

It is a reference for C (and C++), not a comparison between different
languages, and as such it keeps much of the language and terminology of
the language standards.  en.cppreference.com is good when you want a
more complete and accurate reference than you might get from Wikipedia
or a tutorial page, but it's easier to navigate and read than the C
standards and comes with examples (in some cases).  I'm not suggesting
that it is the only site to use - others can be better in different
ways.  But it is a useful source of reference information for C.

[toc] | [prev] | [next] | [standalone]


#157826

FromKeith Thompson <Keith.S.Thompson+u@gmail.com>
Date2020-12-27 12:03 -0800
Message-ID<87tus781a6.fsf@nosuchdomain.example.com>
In reply to#157811
Bart <bc@freeuk.com> writes:
> On 27/12/2020 02:28, T wrote:
>> On 12/26/20 8:31 AM, Scott Lurndal wrote:
>>> T <T@invalid.invalid> writes:
>>>> Hi All,
>>>>
>>>> I the following code, I do beleive I hae everything
>>>> figured out, except for "&rawtime". It looks like it
>>>> is a time_t (long long integer or 64 bit integer).
>>>> What does the "&" do to the variable?
>>>
>>> https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B
>>
>> Awesome!  Thank you!  I am going to save the list
>> in my documentation.
>
> Take care because that list seems be primarily for C++, although many
> operators are shared.

The table in that article distinguishes very clearly between operators
that are specific to C++ and those that appear on both languages.  I'm
not sure why you felt the need to warn about it.

> In C++, & is also used in parameter lists to indicate reference parameters.

Yes, but that's not an operator.

[snip]

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips Healthcare
void Void(void) { Void(); } /* The recursive call of the void */

[toc] | [prev] | [next] | [standalone]


#157828

FromBart <bc@freeuk.com>
Date2020-12-27 20:33 +0000
Message-ID<zc6GH.294530$ca39.98522@fx28.ams4>
In reply to#157826
On 27/12/2020 20:03, Keith Thompson wrote:
 > Bart <bc@freeuk.com> writes:
 >> On 27/12/2020 02:28, T wrote:
 >>> On 12/26/20 8:31 AM, Scott Lurndal wrote:
 >>>> T <T@invalid.invalid> writes:
 >>>>> Hi All,
 >>>>>
 >>>>> I the following code, I do beleive I hae everything
 >>>>> figured out, except for "&rawtime". It looks like it
 >>>>> is a time_t (long long integer or 64 bit integer).
 >>>>> What does the "&" do to the variable?
 >>>>
 >>>> https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B
 >>>
 >>> Awesome!  Thank you!  I am going to save the list
 >>> in my documentation.
 >>
 >> Take care because that list seems be primarily for C++, although many
 >> operators are shared.
 >
 > The table in that article distinguishes very clearly between operators
 > that are specific to C++ and those that appear on both languages.  I'm
 > not sure why you felt the need to warn about it.

I've had another look, and I can see it really is about C++ and not C.

The only concession to C is the one column 'Included in C'.

I hadn't realised there was such a scarcity of online resources that 
would summarise the operators in C and only C (not largely consisting of 
distracting details relevant only to C++), and would do clearly and 
correctly.

[toc] | [prev] | [next] | [standalone]


#157829

FromT <T@invalid.invalid>
Date2020-12-27 17:43 -0800
Message-ID<rsbd83$t8f$1@dont-email.me>
In reply to#157811
On 12/27/20 4:31 AM, Bart wrote:
> On 27/12/2020 02:28, T wrote:
>  > On 12/26/20 8:31 AM, Scott Lurndal wrote:
>  >> T <T@invalid.invalid> writes:
>  >>> Hi All,
>  >>>
>  >>> I the following code, I do beleive I hae everything
>  >>> figured out, except for "&rawtime". It looks like it
>  >>> is a time_t (long long integer or 64 bit integer).
>  >>> What does the "&" do to the variable?
>  >>
>  >> https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B
>  >>
>  >
>  > Awesome!  Thank you!  I am going to save the list
>  > in my documentation.
> 
> Take care because that list seems be primarily for C++, although many 
> operators are shared.
> 
> In C++, & is also used in parameter lists to indicate reference parameters.
> 
> But, I've just had a look at this: 
> https://docs.raku.org/language/operators. That makes C++ look simple!


Actually, the system calls in Windows tend to be C++ and
the system calls in Linux tend to be C, so the reference
is going to come in really handy!

:-)


[toc] | [prev] | [next] | [standalone]


#157834

FromDavid Brown <david.brown@hesbynett.no>
Date2020-12-28 11:00 +0100
Message-ID<rscab9$g4n$1@dont-email.me>
In reply to#157829
On 28/12/2020 02:43, T wrote:
> On 12/27/20 4:31 AM, Bart wrote:
>> On 27/12/2020 02:28, T wrote:
>>  > On 12/26/20 8:31 AM, Scott Lurndal wrote:
>>  >> T <T@invalid.invalid> writes:
>>  >>> Hi All,
>>  >>>
>>  >>> I the following code, I do beleive I hae everything
>>  >>> figured out, except for "&rawtime". It looks like it
>>  >>> is a time_t (long long integer or 64 bit integer).
>>  >>> What does the "&" do to the variable?
>>  >>
>>  >> https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B
>>  >>
>>  >
>>  > Awesome!  Thank you!  I am going to save the list
>>  > in my documentation.
>>
>> Take care because that list seems be primarily for C++, although many
>> operators are shared.
>>
>> In C++, & is also used in parameter lists to indicate reference
>> parameters.
>>
>> But, I've just had a look at this:
>> https://docs.raku.org/language/operators. That makes C++ look simple!
> 
> 
> Actually, the system calls in Windows tend to be C++ and
> the system calls in Linux tend to be C, so the reference
> is going to come in really handy!
> 

System calls in Windows normally use C semantics, IIRC - C is generally
used as the "lingua franca" of programming languages, and OS's ABI's are
usually defined in C terms.  (That doesn't mean that either the calling
language, or the called language, have to be C - it's just the lowest
common denominator in the middle.)

Different libraries on top of the OS can be in C++, or other languages,
whether you are talking about Windows or Linux.

And operators are not going to be relevant in how you call functions,
regardless of what language the interface is written in.  (The "&" in
parameters lists in C++, or the "*" in parameter lists in both C and
C++, is not an operator - it is part of the type declaration.)

Still, understanding the operators will make it easier to understand
examples - and if the examples you find are in C++, understanding C++
operators is helpful.


[toc] | [prev] | [next] | [standalone]


#157836

FromBart <bc@freeuk.com>
Date2020-12-28 11:16 +0000
Message-ID<58jGH.172351$oT47.146600@fx20.ams4>
In reply to#157829
On 28/12/2020 01:43, T wrote:
> On 12/27/20 4:31 AM, Bart wrote:
>> On 27/12/2020 02:28, T wrote:
>>  > On 12/26/20 8:31 AM, Scott Lurndal wrote:
>>  >> T <T@invalid.invalid> writes:
>>  >>> Hi All,
>>  >>>
>>  >>> I the following code, I do beleive I hae everything
>>  >>> figured out, except for "&rawtime". It looks like it
>>  >>> is a time_t (long long integer or 64 bit integer).
>>  >>> What does the "&" do to the variable?
>>  >>
>>  >> https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B
>>  >>
>>  >
>>  > Awesome!  Thank you!  I am going to save the list
>>  > in my documentation.
>>
>> Take care because that list seems be primarily for C++, although many 
>> operators are shared.
>>
>> In C++, & is also used in parameter lists to indicate reference 
>> parameters.
>>
>> But, I've just had a look at this: 
>> https://docs.raku.org/language/operators. That makes C++ look simple!
> 
> 
> Actually, the system calls in Windows tend to be C++ and
> the system calls in Linux tend to be C, so the reference
> is going to come in really handy!

Many of the original Windows API libraries (eg. gdi32, user32, kernel32) 
used to use C in their interfaces.

They still do, but MSDN docs now label them as C++ even though they are 
not. (I think the assumption is that you will use MS' VC compiler.)

Some actually are C++, but when they use C++-specific features, it's 
going to be harder to use from another language.

[toc] | [prev] | [next] | [standalone]


#157830

FromT <T@invalid.invalid>
Date2020-12-27 20:36 -0800
Message-ID<rsbncn$h37$1@dont-email.me>
In reply to#157811
On 12/27/20 4:31 AM, Bart wrote:
> 
> But, I've just had a look at this: 
> https://docs.raku.org/language/operators. That makes C++ look simple!

Hi Bart,

Boy do you ever have a valid point there!

Fortunately, in Raku, there are always several (101)
ways for doing the same thing, so I an get around
the "what the h*** is that abbreviation.  They often
have the same thing spelled out.

I write in Top Down and try to spend extra time up
front making things readable when I have to go back
and maintain them.  It is 10 times easier to do it up
front than to have to figure it out later.

For instance:
     method BadAdd()  {
           my $Clinker = (-5.1 .. 5.1).rand.truncate;
           return $!A + $!B + $Clinker;
     }

versus
      method BadAdd()  {
           $!A + $!B + (-5.1 .. 5.1).rand.truncate;
      }

I use "Clinker" to make it obvious and I use the
unnecessary "return" statement to make that obvious
too.  It is how you turn a language into a
read / write language versus a write only language.
Top Down helps a lot too

If I could posit a guess on the abbreviations, I think
it is for folks that can't type (I can) and/or for
show offs.

:-)

-T

[toc] | [prev] | [next] | [standalone]


#157833

FromT <T@invalid.invalid>
Date2020-12-27 20:48 -0800
Message-ID<rsbo2d$jm4$2@dont-email.me>
In reply to#157830
On 12/27/20 8:36 PM, T wrote:
> Fortunately, in Raku, there are always several (101)
> ways for doing the same thing, so I an get around
> the "what the h*** is that abbreviation.  They often
> have the same thing spelled out.

“Anyone who can only think of one way to spell a
word obviously lacks imagination.”
    -- Mark Twain

[toc] | [prev] | [next] | [standalone]


#157822

FromBonita Montero <Bonita.Montero@gmail.com>
Date2020-12-27 18:30 +0100
Message-ID<rsagce$s2o$1@dont-email.me>
In reply to#157791
>> Hi All,
>> I the following code, I do beleive I hae everything
>> figured out, except for "&rawtime". It looks like it
>> is a time_t (long long integer or 64 bit integer).
>> What does the "&" do to the variable?

> https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B

I just learned something new: you can overload operator ->* in C++.

[toc] | [prev] | [next] | [standalone]


#158689

FromJohn Bode <jfbode1029@gmail.com>
Date2021-01-28 11:02 -0600
Message-ID<d480cc65-e99d-45d8-cdbc-170a8dcc686c@gmail.com>
In reply to#157771
Very late to this party, as usual.

On 12/25/20 9:31 PM, T wrote:
> Hi All,
> 
> I the following code, I do beleive I hae everything
> figured out, except for "&rawtime". It looks like it
> is a time_t (long long integer or 64 bit integer).
> What does the "&" do to the variable?
> 

The unary '&' operator is the address-of operator - the result
of '&rawtime' is the address of the 'rawtime' variable.

IOW, '&rawtime' is a pointer expression, and the type of the
expression is 'time_t *' (pointer to 'time_t').

The 'time()' function expects a 'time_t *' (pointer to 'time_t')
value as its argument.  In this case it's because 'time()'
needs to write a new value to 'rawtime' and C functions can only
update parameters through pointers.

'localtime()' also expects a time_t *' argument, although
it doesn't actually modify the parameter.  Sometimes pointers
are used to hide platform-dependent specifics, sometimes
they're used to minimize the amount of data that has to be
passed directly to the function (minimize stack space or
register usage), etc.

'time_t' is a real (scalar) type that can represent time values;
its exact representation is implementation-dependent.  It *may*
be a 64-bit integer, or it may be something else.

> 
> https://www.cplusplus.com/reference/ctime/localtime/
> 
> /* localtime example */
> #include <stdio.h>      /* puts, printf */
> #include <time.h>       /* time_t, struct tm, time, localtime */
> 
> int main ()
> {
>    time_t rawtime;
>    struct tm * timeinfo;
> 
>    time (&rawtime);
>    timeinfo = localtime (&rawtime);
>    printf ("Current local time and date: %s", asctime(timeinfo));
> 
>    return 0;
> }
> 
> 
> 
> Many thanks,
> -T

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.c


csiph-web