• Best of luck to the class of 2024 for their HSC exams. You got this!
    Let us know your thoughts on the HSC exams here
  • YOU can help the next generation of students in the community!
    Share your trial papers and notes on our Notes & Resources page
MedVision ad

Declaring Variables (1 Viewer)

velox

Retired
Joined
Mar 19, 2004
Messages
5,521
Location
Where the citi never sleeps.
Gender
Male
HSC
N/A
I got some answer to this question, but its really dodgy :(

Some variables can be declared directly whereas others must have their structure define first. Why is this the cae? Explain using examples.
Any help is really appreciated :)
 

Winston

Active Member
Joined
Aug 30, 2002
Messages
6,128
Gender
Undisclosed
HSC
2003
Give me an example of what ur saying... is this vb.net?
 

Winston

Active Member
Joined
Aug 30, 2002
Messages
6,128
Gender
Undisclosed
HSC
2003
I think he's refering to some variables can be defined directly because there pre-defined types, and at sometimes u gotta define your own types using structures.
 

J0n

N/A
Joined
Aug 28, 2003
Messages
410
Gender
Male
HSC
2004
Well, structured datatypes such as records (User Defined Types in VB, or Structs/Unions in C++), must have their structures defined first before they can be simply declared using their datatype.
e.g. if you made a coordinate datatype, in VB, you would do something like:
Type Coordinate
X As Long
Y As Long
End Type

Then somewhere else, you could simply state:
Dim MyCoordinate ass Coordinate
 

Winston

Active Member
Joined
Aug 30, 2002
Messages
6,128
Gender
Undisclosed
HSC
2003
err because the type doesn't exist? and if you wanted a certain type, you'd have to define it obviously.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top