Regarding sizeof operator

V

venkat

Hi,
I am new to c programming language. I heard that , sizeof can be
made as run time operator. Even though it is a compile time operator.
I am not sure also whether sizeof can be made as run time operator. If
it can be made as run time operator, Please clarify me how to make it
as run time operator?. what configurations have to do , to get this
behavior.
Please clarify my doubt.

Thanks,
Venkat.
 
C

Chris Dollin

venkat said:
Hi,
I am new to c programming language. I heard that , sizeof can be
made as run time operator. Even though it is a compile time operator.
I am not sure also whether sizeof can be made as run time operator. If
it can be made as run time operator, Please clarify me how to make it
as run time operator?. what configurations have to do , to get this
behavior.

`sizeof` is calculated at compile-time unless its operand is a
(C99-specific) variable-length array.

Some particular uses of `sizeof` can be re-expressed using `&`,
`[]`, and `-` operators, but the compiler will be quite at
liberty to optimise them away and so still have no run-time
code for them. And anyway, given that `sizeof` is a language
feature, why bother with imitations?
 
S

santosh

venkat said:
Hi,
I am new to c programming language. I heard that , sizeof can be
made as run time operator. Even though it is a compile time operator.
I am not sure also whether sizeof can be made as run time operator. If
it can be made as run time operator, Please clarify me how to make it
as run time operator?. what configurations have to do , to get this
behavior.
Please clarify my doubt.

This particular question seems to be a curious obsession with newbies.
Search this group's archive in Google Groups. This has been discussed
time and time again. Use a search string like "Implementing sizeof."
 
R

Richard Tobin

I am new to c programming language. I heard that , sizeof can be
made as run time operator. Even though it is a compile time operator.
I am not sure also whether sizeof can be made as run time operator. If
it can be made as run time operator, Please clarify me how to make it
as run time operator?. what configurations have to do , to get this
behavior.
[/QUOTE]
This particular question seems to be a curious obsession with newbies.

I suspect that it's a homework question set in some C programming
course, probably in India, since many of the people asking this and
similar questions have Indian-sounding names.

-- Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top