I am writing a C program, but I get the following error for the pvowels pointer:
[cquery] initializer element is not a compile-time constant
Here is the code:
int n = 5;
char *pvowels = (char *) malloc(n * sizeof(char));
pvowels[0] = 'A';
pvowels[1] = 'E';
*(pvowels + 2) = 'I';
pvowels[3] = 'O';
*(pvowels + 4) = 'U';
for(int i = 0; i < n; i++) {
printf("%c ", pvowels[i]);
}
printf("\n");
free(pvowels);