|
-
Jun 5th, 2001, 02:48 PM
#1
Thread Starter
Banned
Dynamic array in a struct?
-
Jun 5th, 2001, 03:43 PM
#2
Thread Starter
Banned
Second question
Is there any Real data type? I read it here.
-
Jun 5th, 2001, 03:47 PM
#3
Frenzied Member
Code:
Data Type Ranges
C/C++ recognizes the types shown in the table below.
Type Name Bytes Other Names Range of Values
int * signed,
signed int System dependent
unsigned int * unsigned System dependent
__int8 1 char,
signed char –128 to 127
__int16 2 short,
short int,
signed short int –32,768 to 32,767
__int32 4 signed,
signed int –2,147,483,648 to 2,147,483,647
__int64 8 none –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
char 1 signed char –128 to 127
unsigned char 1 none 0 to 255
short 2 short int,
signed short int –32,768 to 32,767
unsigned short 2 unsigned short int 0 to 65,535
long 4 long int,
signed long int –2,147,483,648 to 2,147,483,647
unsigned long 4 unsigned long int 0 to 4,294,967,295
enum * none Same as int
float 4 none 3.4E +/- 38 (7 digits)
double 8 none 1.7E +/- 308 (15 digits)
long double 10 none 1.2E +/- 4932 (19 digits)
-
Jun 5th, 2001, 04:59 PM
#4
Thread Starter
Banned
Vlatko...
I didn't ask for a complete list of all data types. In this case a simple yes or no would be enough.
As for the first question...?
-
Jun 5th, 2001, 05:12 PM
#5
Monday Morning Lunatic
Real is a misnomer -- integers are real numbers as well Float is correct because the decimal point "floats" around the number depending on the exponent.
Code:
struct mystruct {
int *piArray;
};
void somecode() {
mystruct xx;
x.piArray = new int[50];
delete[] x.piArray;
}
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jun 6th, 2001, 05:52 AM
#6
Thread Starter
Banned
My apologies Vlatko
You're right. The thing is that I was considering more irrational numbers which are real too. I should have mentioned it.
Finally I see a practic use of pointers! I'm following the cplusplus tutorial which talks about many things, but it's kinda difficult to me to see how can I use them. In time I'll see it perhaps.
One of those things is a class. I see it like a way of organizing our code better. Am I wrong? I was watching this interesting thread started by kedaman. He mentions the use of classes to solve the problem. In which way can it be good to use a class? (in general, not only in this particular case)
http://161.58.186.97/showthread.php?...ational+number
-
Jun 6th, 2001, 03:50 PM
#7
Thread Starter
Banned
....ok
Found a good example that shows to me a good use of classes (just closing topic).
If anyone is interested:Polynomial Class
Later
-
Jun 6th, 2001, 03:52 PM
#8
Monday Morning Lunatic
Didn't someone post that quite a while ago?
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jun 6th, 2001, 03:54 PM
#9
Thread Starter
Banned
Yep,
Hurray for search feature!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|