fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main() {
  5. char name[100];
  6. char id[20];
  7. char result[150];
  8.  
  9. printf("Enter your Name: ");
  10. gets(name);
  11.  
  12. printf("Enter your ID: ");
  13. gets(id);
  14.  
  15. // Concatenate ID and Name → result = id + space + name
  16. strcpy(result, id); // Copy ID to result
  17. strcat(result, " "); // Add space
  18. strcat(result, name); // Add Name
  19.  
  20. printf("After Concatenation: %s\n", result);
  21.  
  22. return 0;
  23. }
Success #stdin #stdout 0s 5320KB
stdin
MD. TAHMIR AMIN KHAN
2243081020
stdout
Enter your Name: Enter your ID: After Concatenation: 2243081020 MD. TAHMIR AMIN KHAN