i had been asked two questions by my teacher which i couldn't answer:
1.what is conditional operator (which i know) and COMPARE IT WITH OTHER SIMILAR CONSTRUCTION IN C++
2.HOW MANY DATA BYTES ARE USED TO STORE A USER DEFINED DATA TYPE ie.for STRUCTURES
Some questions related to c++?
You know a conditional operator is something like if () {} else {}
For #1., the teacher wants you to compare that to something like while {}, or for () {}.
For #2, if you make your own data type, like a structure, the size in bytes will be the size of all the components added together. So if you define a type called tINT32 that is really just an int,
#define tINT32 int
then it will be the same size as an int.
If you define a struct that has two ints in it, then it will be the size of an int * 2. If your compiler gives 32 bytes for an int, the struct will be 64 bytes.
If it has two ints and a 6 element array of chars, then the size will be (2 * 32) + (6*8)
carnation
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment