Friday 22 March 2013

int ret(int ret)


    void main()
{
    int k=ret(sizeof(float));
    printf("\n here value is %d",++k);
}
int ret(int ret)
{
    ret += 2.5;
    return(ret);
}
Answer:
 Here value is 7
Explanation:
    The int ret(int ret), ie., the function name and the argument name can be the same.
    Firstly, the function ret() is called in which the sizeof(float) ie., 4 is passed,  after the first expression the value in ret will be 6, as ret is integer hence the value stored in ret will have implicit type conversion from float to int. The ret is returned in main() it is printed after and preincrement.

Blog Author: Vijay Kumar

No comments:

Post a Comment