@Rajat Dubey

Actually C forbids the use of sizeof() operator to a function  name .(you
can see the warning using "gcc -pedantic" option of gcc )

so by writing
printf("%d",sizeof(fn) );  // u r trying to get the size of function "fn"
which in no way legal .
and output 1 is compiler dependent .

compile above program with g++ (that is in C++ )  you will get Error as it
has been made illegal in c++ now. and applyiong ""sizeof " to an expression
of funtion type is illegal.

// but printf("%d\n",sizeof(fn())); here its the "sizeof " return value of
function call

On Sun, Sep 2, 2012 at 11:12 AM, RAJAT DUBEY <rajatdubey2...@gmail.com>wrote:

> @Rahul kumar Dubey
>
> #include<stdio.h>
> double fn(char *a , int b , char c)
> {
> return (1.1);
> }
>
> int main()
> {
> int it = 2;
> char ct = 'c';
> char a[30];
> printf("%d\n",(sizeof(fn)));
> }
>
> why it is always giving output as 1 irrespective of the return type of
> function ??
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
*RAHUL KUMAR DUBEY*
*BTech-3rd  year *
*Computer Science &Engineering *
*Motilal Nehru National Institute Of Technology*
*Allahabad[211004],UP.*

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to