hi everyone
I am using ccs compiler version 4.124
I was seeing the example file rtctimer.c
In this example file structures are used.and to access elements of those structures "->" symbol is used like
Code:
unixTime += timeT->tm_sec;
we can also use it as this way
Code:
unixTime += timeT.tm_sec;
what is the difference between both?
From where i can read and study about supported syntax in ccs?
Ttelmah
Joined: 11 Mar 2010 Posts: 19546
Posted: Wed Feb 24, 2016 3:51 am
Read a C textbook!...
-> is used as a shorthand when dealing with a pointer to a structure.
If 'p' is a pointer to a structure, then p->member accesses the member in the structure being pointed to.
The -> is used inside a function, where timeT has been passed as a pointer.
It's a shorthand for (*timeT).member
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum