1 #include <stdio.h>
2 void my_strcpy(const char *src, char *dst) 3 { 4 int ch; 5 __asm 6 { 7 loop: 8 LDRB ch, [src], #1 9 STRB ch, [dst], #1 10 CMP ch, #0 11 BNE loop 12 } 13 } 14 int main(void) 15 { 16 const char *a = "Hello world!"; 17 char b[20]; 18 my_strcpy (a,b); 19 printf("Original string: '%s'\n", a); 20 printf("Copied string: '%s'\n", b); 21 return 0; 22 } |
电工学习网 ( )
GMT+8, 2021-12-6 20:44