![]() |
| | #1 |
| Registered User Join Date: Feb 2010
Posts: 3
| Help A structure pointer times of type time (which has three fields, all pointers to integers, day, month and year respectively) is declared. Using the pointer times, update the field day to 10. a) times.day=10 b) *(times->day)=10 c) *times.day=10; d) times.day=*10 I personally think that the answer should be either times->day =10 or (*times).day=10. However both of these are not the given choices...... Last edited by yuyu909; 02-09-2010 at 07:25 AM. |
| yuyu909 is offline | |
| | #2 |
| I like turtles Join Date: Sep 2009 Location: Ohio
Posts: 311
| The rule of thumb is that if a struct is declared as a plain struct, you use the ., if it is declared as a pointer, you use the ->. So I'd go with b. |
| Epy is offline | |
| | #3 | ||
| C++ Witch Join Date: Oct 2003 Location: Singapore
Posts: 11,275
| Quote:
Quote:
__________________ C + C++ Compiler: MinGW port of GCC Build + Version Control System: SCons + Bazaar Look up a C/C++ Reference and learn How To Ask Questions The Smart Way | ||
| laserlight is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|