In the max function, return statement can't be present as an
expression in ternary conditional operator. it should be like return x
> y ? x ; y;

In the second question, p is a pointer to a pointer to a const char,
but argv is a pointer to a pointer to a char. The difference lies in
the type of operand to which argv and p point.



On 9/5/11, Mohit Goel <[email protected]> wrote:
> 1) #include <stdio.h>
>    #define PrintInt(expr) printf("%s : %d\n",#expr,(expr))
>    int max(int x, int y)
>   {
>        (x > y) ? return x : return y;
>   }
>
>    int main ()
>   {
>        int a = 10, b = 20;
>         PrintInt(a);
>         PrintInt(b);
>         PrintInt(max(a,b));
>   }
>
> 2    #include <stdio.h>
>   void foo(const char **p) { }
>    int main (int argc, char **argv)
>   {
>              foo(argv);
>             return 0;
>   }
> i  think sending a normal pointer to a function
> requiring const pointer does not give any warning..but it still giving an
> error....
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
Sanju
:)

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

Reply via email to