二十五岁时我们都一样愚蠢、多愁善感,喜欢故弄玄虚,可如果不那样的话,五十岁时也就不会如此明智。
标题:C示例复制字符串的程序
C示例复制字符串的程序
#include <stdio.h> int main() { char s1[] = "TajMahal"; // String Given char s2[8]; // Variable to hold value int length = 0; while(s1[length] != '\0') { s2[length] = s1[length]; length++; } s2[length] = '\0'; // Terminate the string printf("Value in s1 = %s \n", s1); printf("Value in s2 = %s \n", s2); return 0; }