• Create Account

We're offering banner ads on our site from just \$5!

Posted 14 June 2013 - 05:58 PM

This is something I've been curious about. Say with certain structs/classes, you can define them while declaring them by assigning them to multiple values contained within curly braces. For instance, with the COORD struct:

COORD position = {0, 0, 0};

How do you do this in code? Or is this some strange special case? I can't find anything on the subject.

EDIT: I really should code before I speak. I'm pretty sure you can just define all the variables once you declare a struct, and it'll go down the list of the struct's variables, so if I were to have a similar struct, let's say Vector, with X, Y, and Z values, you would be able to declare and define a variable of its type with Vector = {0,0,0}; This doesn't work for assignment though, for some reason. Is there a way to do that?

Posted 14 June 2013 - 05:51 PM

This is something I've been curious about. Say with certain structs/classes, you can define them while declaring them by assigning them to multiple values contained within curly braces. For instance, with the COORD struct:

COORD position = {0, 0, 0};

How do you do this in code? Or is this some strange special case? I can't find anything on the subject.

EDIT: I really should code before I speak. I'm pretty sure you can just define all the variables once you declare a struct, and it'll go down the list of the struct's variables, so if I were to have a similar struct, let's say Vector, with X, Y, and Z values, you would be able to declare and define a variable of its type with Vector = {0,0,0}; This doesn't work for assignment though, for some reason. Is there a way to do that?

Posted 14 June 2013 - 05:51 PM

This is something I've been curious about. Say with certain structs/classes, you can define them while declaring them by assigning them to multiple values contained within curly braces. For instance, with the COORD struct:

COORD position = {0, 0, 0};

How do you do this in code? Or is this some strange special case? I can't find anything on the subject.

EDIT: I really should code before I speak. I'm pretty sure you can just define all the variables once you declare a struct, and it'll go down the list of the struct's variables, so if I were to have a similar struct, let's say Vector, with X, Y, and Z values, you would be able to declare and define a variable of its type with Vector = {0,0,0}; This doesn't work for assignment though, for some reason. Is there a way to do that?

Posted 14 June 2013 - 05:50 PM

This is something I've been curious about. Say with certain structs/classes, you can define them while declaring them by assigning them to multiple values contained within curly braces. For instance, with the COORD struct:

COORD position = {0, 0, 0};

How do you do this in code? Or is this some strange special case? I can't find anything on the subject.

FIXED

I really should code before I speak. I'm pretty sure you can just define all the variables once you declare a struct, and it'll go down the list of the struct's variables, so if I were to have a similar struct, let's say Vector, with X, Y, and Z values, you would be able to declare and define a variable of its type with Vector = {0,0,0};

ugh sorry

Posted 14 June 2013 - 05:49 PM

This is something I've been curious about. Say with certain structs/classes, you can define them while declaring them by assigning them to multiple values contained within curly braces. For instance, with the COORD struct:

COORD position = {0, 0, 0};

How do you do this in code? Or is this some strange special case? I can't find anything on the subject.

FIXED

I really should code before I speak. I'm pretty sure you can just define all the variables once you declare a struct, and it'll go down the list of the struct's variables, so if I were to have a similar struct, let's say Vector, with X, Y, and Z values, you would be able to declare and define a variable of its type with Vector = {0,0,0};

ugh sorry

Posted 14 June 2013 - 05:42 PM

This is something I've been curious about. Say with certain structs/classes, you can define them while declaring them by assigning them to multiple values contained within curly braces. For instance, with the COORD struct:

COORD position = {0, 0, 0};

How do you do this in code? Or is this some strange special case? I can't find anything on the subject.

PARTNERS