passing arg 1 of `foo' from incompatible pointer type

后端 未结 3 984
囚心锁ツ
囚心锁ツ 2021-01-26 10:11

Why this shows warning:

#include
foo (const char **p)
{ 

}

int main(int argc , char **argv)
{
    foo(argv);
}

But following

3条回答
  •  有刺的猬
    2021-01-26 10:38

    See the C FAQ list

    You can cast in order to remove warnings:

    foo((const char **)argv);
    

    But as FAQ says: the need for such a cast may indicate a deeper problem which the cast doesn't really fix.

提交回复
热议问题