943,925 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 2710
  • C RSS
Jun 18th, 2004
0

New Type

Expand Post »
Need to define a new type in "C."
New type is "datetime."
Use two variables: birthDate, tempdate

If I use birthdate= tempdate + 20;

how can I assign 20 to be:
minutes
years
seconds
days
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
minnie is offline Offline
5 posts
since Jun 2004
Jun 18th, 2004
0

Re: New Type

You can use structures
  1. struct Dtime
  2. {
  3. int mins;
  4. int years;
  5. int days;
  6. };
The to declare a variable:
  1. dtime datetime;

And to assig values.

  1. datetime.min = 10;
  2. datetime.year = 2004;

Just use the var_name.member and you can do anything to them as would do to a normal int, char etc.
Reputation Points: 108
Solved Threads: 7
Posting Whiz in Training
FireNet is offline Offline
256 posts
since May 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: Please help with algorithm
Next Thread in C Forum Timeline: How to use alloc's memory allocation functions?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC