please can anybody help me to implement sizeof() operator in c..
i know the usage .. but i was not able to implement it.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can’t implement
sizeofin C; it’s a basic operator (you can’t implement+either).You could write a macro that has a limited subset of
sizeof‘s behavior, by doing something along the lines of:but that only works if
ais an lvalue (and it’s horrible to behold).sizeofis not so limited, and that’s why you should use it instead of reinventing a wheel that isn’t actually round.