New Type

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jun 2004
Posts: 5
Reputation: minnie is an unknown quantity at this point 
Solved Threads: 0
minnie minnie is offline Offline
Newbie Poster

New Type

 
0
  #1
Jun 18th, 2004
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
Reply With Quote Quick reply to this message  
Join Date: May 2004
Posts: 256
Reputation: FireNet will become famous soon enough FireNet will become famous soon enough 
Solved Threads: 6
FireNet's Avatar
FireNet FireNet is offline Offline
Posting Whiz in Training

Re: New Type

 
0
  #2
Jun 18th, 2004
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.
See what you can, remember what you need

Fourzon | Earn via Coding
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC