/ *
* Purpose: Program to demonstrate the 'strcpy' function.
* Author: M J Leslie
* Date: 12-Mar-94
*/
#include <string.h> /* strcpy */
main()
{
char text1[20]="martin"; /* string buffer */
char text2[20]="leslie"; /* string buffer */
printf (" original string contents are: %s\n", text1);
/* Copy text2 into text1.
If text1 is smaller that text2
it will probably overwrite
something! */
strcpy(text1, text2);
printf (" new string contents are: %s\n", text1);
strcpy(text1, "linux");
printf (" final string contents are: %s\n", text1);
}
| file: /techref/language/ccpp/cref/EXAMPLES/strcpy.c, 0KB, , updated: 1997/4/21 09:52, local time: 2010/3/20 19:15,
38.107.191.114:LOG IN
|
| ©2010 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? Please DO link to this page! Digg it! <A HREF="http://www.piclist.com/techref/language/ccpp/cref/EXAMPLES/strcpy.c"> language ccpp cref EXAMPLES strcpy</A> |
| Did you find what you needed? |
|
The PICList shop now offers mugs, steins and... T-Shirts!!! |
.