i need help

This is a discussion on i need help within the C Programming forums, part of the General Programming Boards category; if the user key in abc, the ouput should be acbbca(where by the reversed string is inserted one character after ...

  1. #1
    Registered User
    Join Date
    Jun 2003
    Posts
    7

    Unhappy i need help

    if the user key in abc, the ouput should be acbbca(where by the reversed string is inserted one character after the other)

    i've wrote the code but it display null
    Here's the code of the functio:

    void InsertStringRev( char input[]){
    int r;
    char reverse[20];
    strrev(input);
    strcpy(reverse, input);
    strrev(input);
    for( r=0; r < strlen( input ); r++)
    gotoxy(5,16);printf("Result :%s%s",input[r],reverse[r]);
    getch();clrscr();
    }

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    Your printf is wrong, try this:
    Code:
    printf("%c%c",input[r],reverse[r]);
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21