Mega Code Archive

 
Categories / C Tutorial / String
 

String constants consist of text enclosed in double quotes

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);         }