Mega Code Archive

 
Categories / C / String
 

How to use strcpy (string copy)

/* Practical C Programming, Third Edition By Steve Oualline Third Edition August 1997  ISBN: 1-56592-306-5 Publisher: O'Reilly */ #include <string.h> #include <stdio.h> char name[30];    /* First name of someone */ int main() {     strcpy(name, "Sam");    /* Initialize the name */     printf("The name is %s\n", name);     return (0); }