473,385 Members | 1,506 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

sizeof() operator/function?

HI,

What is the reason, behind Sizeof being treated as an operator and not as a function, even though we use "()" (paranthesis)

Could some one please explain this..

Thanks and Regards
Gunapal
Mar 28 '07 #1
3 2513
JosAH
11,448 Expert 8TB
HI,
What is the reason, behind Sizeof being treated as an operator and not as a function, even though we use "()" (paranthesis)
Gunapal
Well, maybe the sizeof thingy *is* an operator as defined by the language.
It's a compile time evaluated operator though.

kind regards,

Jos
Mar 28 '07 #2
Well, maybe the sizeof thingy *is* an operator as defined by the language.
It's a compile time evaluated operator though.

kind regards,

Jos
thank you very much!!!!

regards
gunapal
Mar 29 '07 #3
Well, maybe the sizeof thingy *is* an operator as defined by the language.
It's a compile time evaluated operator though.

kind regards,

Jos
hi got the answer !

The sizeof operator must take into account the implementation of the underlying memory allocation scheme to obtain the sizes of various datatypes. sizeof is a compile-time operator, which means that during compilation, sizeof and its operand get replaced by the result-value. This is evident in the assembly language code produced by a C or C++ compiler. For this reason, sizeof qualifies as an operator, even though its use sometimes looks like a function call.

kind regards
gunapal
Mar 29 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

70
by: Roy Yao | last post by:
Does it mean "(sizeof(int))* (p)" or "sizeof( (int)(*p) )" ? According to my analysis, operator sizeof, (type) and * have the same precedence, and they combine from right to left. Then this...
2
by: Xiangliang Meng | last post by:
Hi, all. What will we get from sizeof(a class without data members and virtual functions)? For example: class abnormity { public: string name() { return "abnormity"; }
31
by: Anjali M | last post by:
#include <stdio.h> int main() { int number = 10; printf("Number is: %d\n", number); printf("Sizeof of number is: %d\n", sizeof(number++)); printf("Number now is: %d\n", number);
3
by: srivatsan_b | last post by:
Can anybody please explain how sizeof operator is implemented? Thanks in advance Srivatsan B
42
by: Christopher C. Stacy | last post by:
Some people say sizeof(type) and other say sizeof(variable). Why?
24
by: jimjim | last post by:
Hello all, I was reading the C++ FAQ and I was astonished to learn that sizeof('x') is equal to sizeof(char) in C++, but is equal to sizeof(int) in C. 1. Why is this? 2. Can you provide a...
43
by: Richard | last post by:
Could someone point me to why "sizeof x" is/isnt preferable to "sizeof(x)",
28
by: Howard Bryce | last post by:
I have come across code containing things like sizeof int How come that one can invoke sizeof without any parentheses surrounding its argument? Is this admissible within the standard? Can it...
17
by: venkat | last post by:
Hi, I have written a program void main() { printf("%d %d\n", sizeof main, sizeof(main())); } in this program the output is 1 and 4,
8
by: c.lang.myself | last post by:
whenever we pass an array to function, we have to also pass its size.e.g if i am making a soritng function then void sort(int b,int size); Now I thought about using sizeof operator(macro?)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.