What is the equivalent to the sizeoff(variable) in C

What is the equivalent to the
sizeoff(varname)in C and could I please have an example.
calisAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mcriderCommented:
I think what you're looking for is LEN()

There really is no sizeof in VB.


For example:

Dim X as String
Dim Y as Long
X="abcdefg"
Y=Len(X)
'Y will equal 7


Cheers!
0
mcriderCommented:
Also, if you have the following:

Dim Z as Long
Z=32768

if you do: len(Z) you will always get 4 because it takes 4 bytes to store a long number...

if you do len(cstr(Z)) you will get 5, because there are 5 characters in "32768"


Cheers!
 5
 4
 4
?zz
 0
zz=32767
0
calisAuthor Commented:
I need to find the sizeof of a UDT to pass to my C API
0
mcriderCommented:
Read the following microsoft articles:


HOWTO: Pass Array of UDTs with Variable Length Strings to C/C++
http://support.microsoft.com/support/kb/articles/Q194/6/09.ASP 

HOWTO: Pass Optional Parameters to a C DLL Function from VB
http://support.microsoft.com/support/kb/articles/Q153/5/46.asp 

HOWTO: Call C Functions That Use the _cdecl Calling Convention
http://support.microsoft.com/support/kb/articles/Q153/5/86.asp 


Cheers!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
amebaCommented:
LenB will return size in bytes.
MsgBox LenB(yourUDT)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.