954,505 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

New Type

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

minnie
Newbie Poster
5 posts since Jun 2004
Reputation Points: 10
Solved Threads: 0
 

You can use structures

struct Dtime
{
       int mins;
       int years;
       int days;
};

The to declare a variable:

dtime datetime;


And to assig values.

datetime.min = 10;
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.

FireNet
Posting Whiz in Training
258 posts since May 2004
Reputation Points: 108
Solved Threads: 7
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You