Hey guys,
The lastest episode in the saga of my wrestle to get to grips with C revolves around my inability to handle arrays.
I've been tasked with recreating the Soundex code. This involves several stages - removing vowels from a set of characters, removing double letters, and then translating it into a numeric code.
However, that all sounds pretty daunting, so to get to grips with how arrays work I've taken one task - removing vowels - and started trying to write a program that does just that and that alone, printing the output. However, I seem unable to get something that doesn't yield a 'Permission Denied' error. I'm assuming I'm grossly misunderstanding something along the way.
So far I have:
The lastest episode in the saga of my wrestle to get to grips with C revolves around my inability to handle arrays.
I've been tasked with recreating the Soundex code. This involves several stages - removing vowels from a set of characters, removing double letters, and then translating it into a numeric code.

However, that all sounds pretty daunting, so to get to grips with how arrays work I've taken one task - removing vowels - and started trying to write a program that does just that and that alone, printing the output. However, I seem unable to get something that doesn't yield a 'Permission Denied' error. I'm assuming I'm grossly misunderstanding something along the way.

So far I have:
Code:
#include <stdio.h>
#include <string.h>
#include <math.h>
void devowel(char *B) {
int i=1;
int k=1;
char a[27];/*This is entirely for reference. 26 letters...including 'ender'.*/
a[0] ='A';
a[1] ='B';
a[2] ='C';
a[3] ='D';
a[4] ='E';
a[5] ='F';
a[6] ='G';
a[7] ='H';
a[8] ='I';
a[9] ='J';
a[10] ='K';
a[11] ='L';
a[12] ='M';
a[13] ='N';
a[14] ='O';
a[15] ='P';
a[16] ='Q';
a[17] ='R';
a[18] ='S';
a[19] ='T';
a[20] ='U';
a[21] ='V';
a[22] ='W';
a[23] ='Y';
a[24] ='X';
a[25] ='Z';
a[26] ='\0';
//char B[20]; /*This array will hold the input*/
/* B[20]='\0'; */
scanf ("%s",B);
for (i=0;i<=19;i++) {
if (B[i]==a[0]) {
for (k=0;k<=19;k++){
B[k]=B[k+1];
}
if (B[i]==a[4]) {
for (k=0;k<=19;k++){
B[k]=B[k+1];
}
}
if (B[k]==a[8]) {
for (k=0;k<=19;k++){
B[k]=B[k+1];
}
}
if (B[k]==a[14]) {
for (k=0;k<=19;k++){
B[k]=B[k+1];
}
}
if (B[k]==a[20]) {
for (k=0;k<=19;k++){
B[k]=B[k+1];
}
}
}
printf("%s\n",B);
}
//*int dedouble { }
int main (void) {
char B[20];
devowel(B);
printf("%s\n",B);
return 0;
}
Last edited: