How to assign the variable value of the indicator



  • There's an index. *N; N="it's a good weather today"; char A[100];How to attach importance A N Or just how to get rid of the console. N?



  • If you have a sign that addresses the string literal

    char *N; 
    N = "it's a good weather today"; 
    

    and symbol

    char A[100]; 
    

    You should use standard C. strcpyin the title <string.h> For example,

    #include <string.h>
    

    //...

    strcpy( A, N );

    provided that the size of the mass is sufficient to accommodate the construction literature. Otherwise, the function should be used strncpy

    #include <string.h>

    //...

    strncpy( A, N, sizeof( A ) );
    A[sizeof( A ) - 1] = '\0';

    After that, you can take the line to the console like, for example,

    puts( A );

    or

    printf( "%s\n", A );


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2