User Tools

Site Tools


c:string.h:strcpy

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

c:string.h:strcpy [2013/01/22 22:02]
127.0.0.1 external edit
c:string.h:strcpy [2024/02/16 01:06] (current)
Line 3: Line 3:
 <code c> <code c>
 #include <string.h> #include <string.h>
-//#include <windows.h> /* uncomment this for Windows */ +char *strcpy(char *str1, const char *str2);
- +
-    char *strcpy(char *str1, const char *str2);+
 </code> </code>
  
Line 19: Line 17:
  */  */
 #include <stdio.h> /* including standard library */ #include <stdio.h> /* including standard library */
-//#include <windows.h> /* uncomment this for Windows */ 
-  
 #include <string.h> #include <string.h>
    
-int main( void ) { +int main( void )  
-  +{ 
-char string[] = "copy me"; +  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>

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War
c/string.h/strcpy.1358888560.txt · Last modified: 2024/02/16 01:03 (external edit)

Impressum Datenschutz