defining a string value for structure variable.
I was just going through certain interview questions. Got this structure related issue, I m not understanding what is happening wit the output, Please if some could explain the reason.

When is use a character pointer in the structure like 

  

    #include <stdio.h>
    
    struct name {
        char *array;
    }variable;
    
    int main( int argc, char * argv[] ){
    
        variable.array="hello";
    	printf( "%s\n", variable.array );
    }

The output is `hello` printed, but when change the structure variable to 

    struct name {
        char array[10];
    }variable;

The compiler throws an error "incompatible types in assignment" at 

    variable.array="hello";

I am really confused as to where i am missing the point. Why does it show the error like assignment problem?? Please correct me
Thank you
defining a string value for structure variable.
===

I was just going through certain interview questions. Got this structure related issue, I m not understanding what is happening wit the output, Please if some could explain the reason.

When is use a character pointer in the structure like 

  

    #include <stdio.h>
    
    struct name {
        char *array;
    }variable;
    
    int main( int argc, char * argv[] ){
    
        variable.array="hello";
    	printf( "%s\n", variable.array );
    }

The output is `hello` printed, but when change the structure variable to 

    struct name {
        char array[10];
    }variable;

The compiler throws an error "incompatible types in assignment" at 

    variable.array="hello";

I am really confused as to where i am missing the point. Why does it show the error like assignment problem?? Please correct me
Thank you