Raised This Month: $ Target: $400
 0% 

Question obout sizeof();


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ZASTRELIS
Veteran Member
Join Date: Nov 2010
Location: Siberia, Irkutsk
Old 09-01-2015 , 07:46   Question obout sizeof();
Reply With Quote #1

Code:
char SomeArray[33]; int i_SASize = sizeof( SomeArray );

i_SASize would be 32 or 33? I'm confused after AMXX where we have charsmax();

Last edited by ZASTRELIS; 09-01-2015 at 07:47.
ZASTRELIS is offline
TheUnderTaker
Senior Member
Join Date: Dec 2013
Location: Israel
Old 09-01-2015 , 08:01   Re: Question obout sizeof();
Reply With Quote #2

Size-of
__________________
SourcePawn, C# and C++ Programmer.

My plugin list
TheUnderTaker is offline
Miu
Veteran Member
Join Date: Nov 2013
Old 09-01-2015 , 08:01   Re: Question obout sizeof();
Reply With Quote #3

33
Miu is offline
psychonic

BAFFLED
Join Date: May 2008
Old 09-01-2015 , 08:02   Re: Question obout sizeof();
Reply With Quote #4

sizeof returns the size of the array, 33 in that case. If it were fully populated, then strlen would return 32
psychonic is offline
Potato Uno
Veteran Member
Join Date: Jan 2014
Location: Atlanta, Georgia
Old 09-01-2015 , 08:02   Re: Question obout sizeof();
Reply With Quote #5

33

The compiler will replace that expression with the true array size.
Potato Uno is offline
Potato Uno
Veteran Member
Join Date: Jan 2014
Location: Atlanta, Georgia
Old 09-01-2015 , 08:03   Re: Question obout sizeof();
Reply With Quote #6

LOL this thread was empty when I opened it and by the time I replied, bam 4 responses.

<3 AM
Potato Uno is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:40.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode