Cannot implicitly convert type 'char*' to 'bool'

Posted by neeraj on Stack Overflow See other posts from Stack Overflow or by neeraj
Published on 2012-04-06T11:25:20Z Indexed on 2012/04/06 11:29 UTC
Read the original article Hit count: 216

Filed under:

i was trying to passing pointer value in the function ,
i really got stuck here
I am a beginner , not getting what value should be put
this is programme from the reference of the book "Cracking the coding interview " By Gayle Laakmann McDowell,

class Program
{        
    unsafe void  reverse(char *str)
    {
        char* end = str;
        char tmp;
        if (str) //Cannot implicitly convert type 'char*' to 'bool'
        { 
        while(*end) //Cannot implicitly convert type 'char*' to 'bool'
        {

            ++end;
        }
        --end;
            while(str<end)
            {
                tmp = *str;
                *str+= *end;
                *end-= tmp;
            }
        }
    }

    public static void Main(string[] args)
    {


    }
}

© Stack Overflow or respective owner

Related posts about c#