hi, i just want the join two strings by checking the second string a non vowel word.
suppose,

str1="hello";
str2="world";

here i want the neglect the vowel characters in the second string.
so, i have used 'while loop' for checking each character in the str2.

i used the code something like this,

void main()
{
    char *str1="hello";
    char *str2="world";
    char *s;
    clrscr();
    while(*str2)
    {
        *s=*str2;
        strcat(str1,s);
        *str2++;
    }

    printf("%s",str1);
    getch();
}

required output:hellowrld.(after omitting the vowel character 'o' in str2).

here i didnt check the vowels, but he problem is

i am getting some junk values in the loop.

can anyone tell me what is the mistake. or what is the right way to do this.

Firstly, your trying to concatenate onto a string that's immutable

str1="hello";/*creates a immutable c string*/

strcat(str1,s);/*Can't do this for two reasons, one - str1 isn't big enough and two
str1 in immutable*/
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.