Array elements memory usage question
#1

Hello guys, I'm not sure about this now. When I have array for example:
pawn Код:
new myarray[5];
What is size of one element? Is it 4 bytes, or am I wrong?
That means here: 5 * 4 = 20 bytes in memory it'll took? Please correct me if I'm wrong.
Reply
#2

Код:
new myarray[5];
The number of slots in this array is 6 , such as 0,1,2,3,4,5.
So the conclusion is.
4*6 = 24 bytes
Reply
#3

I think it should be

6(elements in an array)*8(One element's size) = 48 bits

****** ?
Reply
#4

Quote:
Originally Posted by Rittik
Посмотреть сообщение
I think it should be

6(elements in an array)*8(One element's size) = 48 bits

****** ?
That would be correct if the array consist of 6 "elements" (you should at least explain what you understand under elements) but either way it is incorrect

Quote:
Originally Posted by ******
Посмотреть сообщение
I suggest you read the link I posted as well.
Reply
#5

Then what's the answer ****** ,I didn't get any useful information in that lang.pdf.
I still think it's 6*4 = 24 Bytes/Bits
Reply
#6

Quote:
Originally Posted by Rittik
Посмотреть сообщение
Then what's the answer ****** ,I didn't get any useful information in that lang.pdf.
I still think it's 6*4 = 24 Bytes/Bits
array[5] = [0,1,2,3,4]

where the fck u get 6 from
Reply
#7

@IHateYou : Yes you are right I guess, I was totally confused at that time of moment.

Now, The minimum size for char is 8 bit, the minimum size for short and int is 16 bit and for long it is 32 bit.

What do we use in pawno ?
new s=5; instead of int s=5;

So, if it stores an integer value then it should be.

Код:
5 elements*8 bits = 40bits //for integer and short
5 elements*16 bits = 80bits //for long.
Reply
#8

But it's a C type language though.

How so ever.

Please tell me if this is correct or not.

Код:
5 elements * 32bits = 160bits //As per my knowledge of pawn.
If I am in-correct then please correct me.
Reply
#9

Quote:
Originally Posted by Rittik
Посмотреть сообщение
But it's a C type language though.

How so ever.

Please tell me if this is correct or not.

Код:
5 elements * 32bits = 160bits //As per my knowledge of pawn.
If I am in-correct then please correct me.
string[5];

1,2,3,4,5....

It's not 32 bits, it's not 160 bits its fucking 5 bits. Jesus christ.
Reply
#10

Quote:
Originally Posted by Swyft™
Посмотреть сообщение
string[5];

1,2,3,4,5....

It's not 32 bits, it's not 160 bits its fucking 5 bits. Jesus christ.
Can you prove it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)