Author Topic: What does -> mean in the CMSIS libraries?  (Read 1854 times)

0 Members and 1 Guest are viewing this topic.

Offline noname4meTopic starter

  • Regular Contributor
  • *
  • Posts: 93
What does -> mean in the CMSIS libraries?
« on: September 23, 2016, 08:37:54 pm »
Hi

I've been looking through STM's library files provided for programming their microcontrollers and I keep coming across stuff like:

hcdc->CmdOpCode = req->bRequest;

I have tried googling, to no avail, the meaning of the "->" construction.

Can anyone explain this, or point me to something that I can read?

Thanks
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11236
  • Country: us
    • Personal site
Re: What does -> mean in the CMSIS libraries?
« Reply #1 on: September 23, 2016, 08:42:35 pm »
You need to read any book on C. This is pretty basic stuff.

-> is a pointer dereferencing operator. hcdc is a pointer to a structure that has a member CmdOpCode. -> is a way to access members of structures defined as pointers.
Alex
 

Offline noname4meTopic starter

  • Regular Contributor
  • *
  • Posts: 93
Re: What does -> mean in the CMSIS libraries?
« Reply #2 on: September 23, 2016, 08:51:11 pm »
Hi,

..and now I know what it's called - thanks

I've googled it, and understand it now.

I am more familiar with the *...
 

Offline jnz

  • Frequent Contributor
  • **
  • Posts: 593
Re: What does -> mean in the CMSIS libraries?
« Reply #3 on: September 23, 2016, 09:12:10 pm »
Hi,

..and now I know what it's called - thanks

I've googled it, and understand it now.

I am more familiar with the *...

You should be more framiliar with the "."

When it's a struct, it's struct.value when it's a pointer to a struct it's struct_ptr->value
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: What does -> mean in the CMSIS libraries?
« Reply #4 on: September 23, 2016, 10:08:47 pm »
Quote
I've googled it

as others have pointed out, I think you will get far more from your time systemically learning about C than googling it.
================================
https://dannyelectronics.wordpress.com/
 

Offline noname4meTopic starter

  • Regular Contributor
  • *
  • Posts: 93
Re: What does -> mean in the CMSIS libraries?
« Reply #5 on: September 24, 2016, 04:43:56 am »
Actually that IS an easier way to understand it - thanks!

Sent from my SM-G935F using Tapatalk

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf