Ok, this is the same thing. You can see that code I have written up is working, but now i want to do it this way...
It's the same thing but little shorter. Everything works, well not really, if i input "Zadar", output is " aa""" ", instead of " is 2, and for niz3 is " z"d"r " and I want it to be aa, zdr. Any suggestions are most welcome.Code:#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main()
{
int sranje;
char niz[50];
printf("Rijec: ");
fgets(niz,sizeof(niz),stdin);
funk(niz);
scanf("%d", &sranje);
}
int funk(char niz[]){
char *niz2, *niz3;
int i,j=0,d=0;
niz2=malloc(sizeof(char));
niz3=malloc(sizeof(char));
for(i=0;i<strlen(niz)+1;i++){
if(niz[i]>=65 && niz[i]<= 122){
if(niz[i]=='A' || niz[i]=='E' || niz[i]=='I' || niz[i]=='O' || niz[i]=='U' ||
niz[i]=='a' || niz[i]=='e' || niz[i]=='i' || niz[i]=='o' || niz[i]=='u'){
niz2[j]=niz[i];
j++;}
else
niz3[d]=niz[i];
d++;
}
}
printf("%s", niz2);
printf("\n%s", niz3);
}