when i call the indexs() function and when the function is done the values are not changed. when the function index() run they are changed, what can i do to update so many values...
void indexs(int i , char *str,int indexStart,int indexEnd,int wordlen)
{
int words = 1;
int len = strlen(str);
for (int j = 0; j < len; j++)
{
if (str[j] == ' ')
words++;
}
if (i > 0 && i <= words)
{
words = 1;
int k = 0;
while (words != i)
{
if (str[k] == ' ')
++words;
++k;
++wordlen;
if (words == i)
{
indexStart = k;
while (str[k] != ' ' && k != (len-1))
{
wordlen++;
k++;
}
indexEnd = k;
}
}
}
else
{
printf("The index dosen't exsist\n");
}
}
char delete(char *str)
{
int i, indexStart = 0, indexEnd = 0, wordlen = 0;
printf("Enter the index of the word that you want to remove: ");
scanf("%d", &i);
indexs(i, str,indexStart,indexEnd,wordlen);
......
}