Basic C++ question about pointers/structures

In the book that I am using they use two notations for calling structure data members when using pointers.


(*pt).payRate * (*pt).hours ;
(pt ->payRate * pt ->hours);

I understand that in the first line * is dereferencing the pointer so that I can retrieve the data in the address stored in the pointer variable.

I know the second line gives me the same answer as the first but not sure how. Is the second line a short cut, or is it retrieving data differently than the first line?

Thanks in advance.

Replies

You are reading an archived discussion.

Related Posts

I found this site a while ago and have been lurking since then. I had a programming question so I'd thought it was about time I made an account. Major...
About Oracle Open World: - Oracle OpenWorld is the world's largest and most important conference for Oracle technologists, business users, and partners. This annual gathering is the best place to...
India's leading telecom operator is all set to launch 3G services in December. Company's CEO has said that the services will be launched in the following regions - Delhi, Mumbai,...
Here's a nice presentation by the founder of Games2Win, India's one of the first dot com success stories. Give it a look - Games2win- Alok Kejriwal Ppt Presentation Like it?
Samsung electronics is rolling its sleeves up to put your Full HD TVs to shame. The company showcased Ultra Definition 3D Television, 240Hz, 70" wide, that supports resolutions upto 3,840...