C Programming Tutorial – 6 – replace a string with other sting – strcpy():

Note:

  • // replace a string with other sting:
    strcpy(food,”bacon”);

Code:
—————————

#include <stdio.h>
#include <stdlib.h>

int main()
{

char food[]=”tuna”;
printf(“The best food is %s\n”, food);
strcpy(food,”bacon”);                 // replace a string with other sting
printf(“The best food is %s\n”, food);

return 0;

}