This shows you the differences between two versions of the page.
c:string.h:strcpy [2014/04/05 05:02] 188.113.222.212 |
c:string.h:strcpy [2024/02/16 01:06] (current) |
||
---|---|---|---|
Line 19: | Line 19: | ||
#include <string.h> | #include <string.h> | ||
- | int main( void ) { | + | int main( void ) |
- | + | { | |
- | char string[] = "copy me"; /* the size of the array is calculated automatically */ | + | char string[] = "copy me"; /* the size of the array is calculated automatically */ |
- | char string2[20]; | + | char string2[20]; |
- | if( strcpy(string2, string) != 0 ) | + | if( strcpy(string2, string) != 0 ) |
- | printf( "copy success: %s\n", string2 ); | + | printf( "copy success: %s\n", string2 ); |
- | else | + | else |
- | printf( "copy failure\n" ); | + | printf( "copy failure\n" ); |
- | return 0; | + | return 0; |
} | } | ||
</code> | </code> |