Ir para conteúdo
Fórum Script Brasil

Aian Arnaud

Membros
  • Total de itens

    1
  • Registro em

  • Última visita

Tudo que Aian Arnaud postou

  1. GALERA, FIZ O CÓDIGO TODO E ESTÁ FUNCIONANDO. PORÉM, NA HORA DE USAR A FUNÇÃO FREE(), APARECE EXITED WITH NON ZERO STATUS E DÁ ERRO NO CODIGO, alguém PODE ME AJUDAR #include <stdio.h> #include <stdlib.h> char Alocar(char *p, int c){ p=(char*) malloc(c*sizeof(char)); } int main(){ int i, j, x; printf("Digite o tamanho da string: "); scanf("%d", &x); char *ptr, vogais[10]= "aeiouAEIOU", nada[1]=""; Alocar(ptr, x); if(ptr==NULL){ printf("FAIL"); exit(1); } printf("Digite sua string com %d caracteres (espaço conta como caractere): \n", x); scanf(" %[^\n]s", ptr); printf("\n"); printf("\n"); printf("*****String sem vogais*****\n"); printf("\n"); for(i=0; i<x; i++){ for(j=0; j<10; j++){ if(ptr==vogais[j]){ ptr=nada[0]; } } printf("%c", ptr); } free(ptr); ptr=NULL; return 0; }
×
×
  • Criar Novo...