The point of the program is to replace every succession of 2 or more vocals with my name. How can I make that reallocation successful?
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void main() {
char vocale[] = "AEIOUaeiou",
sir[] = "Aana are muaulte meiree.";
char *src = (char*)malloc(strlen(sir) + 1);
src = sir;
char name[] = "Marian";
int count = 0,
i = 0;
while (i < strlen(src)) {
if (strchr(vocale, src[i])) {
count++;
i++;
}
else {
if (count >= 2) {
src = (char*)realloc(src, strlen(src) + strlen(name) + 1);
insereaza(src, count, name, i);
i = i + strlen(name);
count = 0;
}
else {
count = 0;
i++;
}
}
}
puts(src);
_getch();
}