fork(1) download
  1. #include <stdio.h>
  2. #define MAX 500
  3.  
  4. int main() {
  5. char text [MAX+1];
  6.  
  7. printf("Informe o texto (tamanho maximo %d caracteres:", MAX);
  8. fgets(text, sizeof(text), stdin);
  9. text[0] = '*';
  10. for (int i = 0; i <= MAX; i++) {
  11. if (text[i] == ' ') {
  12. text[i + 1] = '*';
  13. }
  14. }
  15. printf("\nO texto final e %s\n", text);
  16. }
Success #stdin #stdout 0s 2164KB
stdin
teste teste teste
stdout
Informe o texto (tamanho maximo 500 caracteres:
O texto final e *este *este *este