fork download
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. #include<string.h>
  4.  
  5. int main(void){
  6. char *name="Asfakul";
  7. char *surname="Laskar";
  8. char *fullname;
  9. int i=0;
  10.  
  11. /*Allocate Memory of 100 char*/
  12. fullname=malloc(100*sizeof(char));
  13.  
  14. while(*name !='\0'){
  15. fullname[i++] = *name++;
  16. }
  17.  
  18. fullname[i] = '\0';
  19.  
  20. puts(fullname);
  21. printf("The Length of the String name is %d\n",i );
  22. printf("The Length of the String fullname is %zu\n",strlen(fullname) );
  23. fullname[i++] = ' ';
  24.  
  25. while(*surname !='\0'){
  26. fullname[i++]= *surname++;
  27. }
  28.  
  29. fullname[i] = '\0';
  30. puts(fullname);
  31.  
  32. free(fullname);
  33. return 0;
  34. }
Success #stdin #stdout 0s 2288KB
stdin
Standard input is empty
stdout
Asfakul
The Length of the String name is 7
The Length of the String fullname is 7
Asfakul Laskar