warning C4047: '=' : 'char' differs in levels of indirection from 'char *'

13,497

*filter is a char and you are assigning it a char * value.

Share:
13,497
Jimson James
Author by

Jimson James

Programmer at heart, designer by brain. Immersed all in BigData. But neck-down in blockchain now.

Updated on June 04, 2022

Comments

  • Jimson James
    Jimson James about 2 years

    What is the problem with the code shown below.

    char filter[2] = {'\0'};
    *filter = (char *)calloc((unsigned int)buf.st_size + 1, sizeof(unsigned char));
    

    As per my understanding, there is no problem changing the array location right? Why I ask this is because of a warning,

    Warning 1   warning C4047: '=' : 'char' differs in levels of indirection from 'char *'
    

    Any idea?

    Got it, changed the code to. Thanks @ouah

    char *filter = {'\0'};
    filter = (char *)calloc((unsigned int)buf.st_size + 1, sizeof(unsigned char));