#include
main(){
char text1[20] = " Mahinda"; /* string buffer */
char text2[20] = " Ranil "; /* string buffer */
/* text2 හි ඇති වචනය text1 ට copy කරන්න.( Copy text2 into text1 ) */
strcpy(text1, text2);
printf (" now string contents are ->%s\n", text1);
/* If text1 is smaller that text2 it will probably overwrite something! */
strcpy(text1, "Fonseka");
printf (" final string contents are: ->%s\n", text1);
}
----------------------------------------------------------------------------------------------------
as@as-desktop:~/Documents/C_CODE$ ./a.out
Original string contents are (ඔරිගිනල් text එක) -> Mahinda
now string contents are -> Ranil
final string contents are: ->Fonseka
################################
No comments:
Post a Comment