Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

Debug a String Code in C

0 votes
asked Apr 6, 2018 by anonymous
int main(void)
{
    char in[20];
    gets(in);
    char in2[20];
    gets(in2);
    char out[39];
    strcat(out,in);
    int index = strlen(in);
    while(index <39){
      out[index] = in2[index-strlen(in)];
        index = index + 1;
    
    printf(out);
    
    }
    
    return 0;
}

2 Answers

0 votes
answered Apr 7, 2018 by kodathalasudarshan reddy (340 points)
If u don't mine can u say what is the problem with the code.
0 votes
answered Apr 7, 2018 by anonymous
I am trying to get it to consternate in and in2 but there seem to be a problem with this line - strcat(out,in); and may be this line - out[index] = in2[index-strlen(in)]; any assistance would be hugely appreciated.
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...