comp.lang.c
[Top] [All Lists]

Re: How can i emulate sizeof()

Subject: Re: How can i emulate sizeof()
From: Kenneth Brody
Date: Wed, 30 Apr 2008 13:26:36 -0400
Newsgroups: comp.lang.c

Eugeny Myunster wrote:
> 
> Hello all,
>         How can i emulate sizeof()
>         only for integers?

I'd really love to know which instructors keep giving this assignment.

Why do you want to "emulate sizeof", when sizeof exists just for this
purpose?

How about:

    #define MySizeof(x) sizeof(x)

Now you can "emulate sizeof" by using "MySizeof(int)", for example.

-- 
+-------------------------+--------------------+-----------------------+
| Kenneth J. Brody        | www.hvcomputer.com | #include              |
| kenbrody/at\spamcop.net | www.fptech.com     |    <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------+
Don't e-mail me at: <mailto:ThisIsASpamTrap@xxxxxxxxx>


<Prev in Thread] Current Thread [Next in Thread>
Privacy Policy