String constants consist of text enclosed in double quotes : String Introduction « String « C Tutorial






We must use the standard library function strcpy to copy the string constant into the variable.

To initialize the variable name to Sam.

#include <string.h>    

    int main() 
    {  
        char    name[4];   
        strcpy(name, "Sam");

        return (0);    
    }








3.1.String Introduction
3.1.1.Strings
3.1.2.A string is an array of characters.
3.1.3.Write string in a more traditional array style
3.1.4.Strings always end with the NULL character
3.1.5.String constants consist of text enclosed in double quotes
3.1.6.Useful string function