fork(1) download
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4.  
  5. #define Nome "nome"
  6. #define TAM_STRING 12
  7.  
  8. int main(void) {
  9. char * str = malloc(TAM_STRING);
  10.  
  11. if(str == NULL) {
  12. printf("Não já espaço para alocar");
  13. } else {
  14. strcpy(str, Nome);
  15. printf("Nome=[%s] tem [%d] caracters",str, strlen(Nome));
  16. for(int i = 0; i < strlen(Nome); i++) {
  17. printf("\nCaracter[%d] = [%c]\n", i , *(str+i));
  18. if(((*(str+i) == 'a')|| (*(str+i) == 'e')) || (*(str+i) == 'i') || (*(str+i )== 'o') || (*(str+i) == 'u')) printf("Vogal");
  19. }
  20. free(str);
  21. }
  22. }
Success #stdin #stdout 0s 2140KB
stdin
Standard input is empty
stdout
Nome=[nome] tem [4] caracters
Caracter[0] = [n]

Caracter[1] = [o]
Vogal
Caracter[2] = [m]

Caracter[3] = [e]
Vogal