質問

I am facing a problem while compiling this code. Any solution would be much appreciated. The code is as follows :

   #include<stdio.h>

    typedef struct nx_string_t
            {
                char *buf;
                int number; 
            }nx_string_t;

    typedef struct nx_value_t
            {
               union
                {
                nx_string_t strng;
                };
            } nx_value_t;

            void func(nx_value_t *vale);
            void check(nx_value_t *str);
            void func(nx_value_t *vale)
            {
                 if(vale->strng.buf == NULL)
                 {
                      printf("its done"); 
                      check(vale->strng);   
                 }
            }
役に立ちましたか?

解決

vale->strng has type nx_string_t. check expects a nx_value_t* so you need to pass vale instead

check(vale);
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top