No, it's wrong to say that sizeof() can't be applied to functions. It's an
operator and can take the function name as its operand.
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To view this discussion on the web visit
https://groups.goog
wat does it mean dat sizweof cannot be applied to functions??den wat is
foo()?is s a func ly na??explain me i cant get it..
//BE COOL// kavi
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@goo
just do it.
u will know ur query result :)
main()
{
int arr[5];
printf("%d %d\n:,sizeof(arr),sizeof(&arr));
}
On Wed, Jul 27, 2011 at 10:43 PM, aditya kumar wrote:
> sizeof calculates at compile time so their is no function call . in case of
> function it gives the size of return type of
sizeof calculates at compile time so their is no function call . in case of
function it gives the size of return type of that function
On Wed, Jul 27, 2011 at 9:41 PM, Abhinav Arora wrote:
> ya Amit is right...
> sizeof(main()) will return 4 because main will return an
> integer.however it wi
ya Amit is right...
sizeof(main()) will return 4 because main will return an integer.however
it will not execute main()..and sizeof(&main) will give 4 too but this time
it is 4 because &main is a pointer to main
another example
#include
#include
double foo();
main()
{
int a,b,c;
>> if you write sizeof(main()) or sizeof(&main)...you will get 4 which will be
>> the size of a pointer
sizeof(main()) and sizeof(&main) are different.
sizeof(main()) is equivalent to sizeof( return type of main )
while sizeof(&main) is sizeof( function pointer )
On Jul 27, 9:02 pm, Abhinav Aror
Thanks a lot !
De : Abhinav Arora
À : algogeeks@googlegroups.com
Cc : Charlotte Swazki
Envoyé le : Mercredi 27 Juillet 2011 16h02
Objet : Re: sizeof() question.
The sizeof operator cannot be used with the following operands:
* Functions. (However, siz
The *sizeof* operator cannot be used with the following operands:
- Functions. (However, *sizeof* can be applied to pointers to functions.)
- Bit fields.
- Undefined classes.
- The type *void*.
- Dynamically allocated arrays.
- External arrays.
- Incomplete types.
- Paren