fork download
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int n;
  5. printf("Size of String: ");
  6. scanf("%d", &n);
  7.  
  8. printf("Input: ");
  9. char str1[n];
  10. char str2[n];
  11. for(int i=0; i<n; i++){
  12. scanf("%c", &str1[i]);
  13. }
  14.  
  15. for(int i=0; i<n; i++){
  16. str2[i] = str1[i];
  17. }
  18.  
  19. printf("Output: ");
  20. for(int i=0; i<n; i++){
  21. printf("%c", str2[i]);
  22. }
  23. }
Success #stdin #stdout 0s 5284KB
stdin
6
keeper
stdout
Size of String: Input: Output: keeper