fork download
  1. #include <stdio.h>
  2.  
  3. // Minimal working example for answer to http://stackoverflow.com/questions/21917578/
  4. int main()
  5. {
  6. char string[4];
  7. int i;
  8.  
  9. printf("Enter some text\n");
  10. scanf(" %c %c %c %c", &string[0], &string[1], &string[2], &string[3]);
  11.  
  12. printf("You Entered ");
  13.  
  14. for (i = 0; i < 4; i++){
  15. printf("%c", string[i]);
  16. }
  17.  
  18. return 0;
  19. }
Success #stdin #stdout 0s 2296KB
stdin
a b c d
stdout
Enter some text
You Entered abcd