1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

reverse a string?

Discussion in 'C' started by senthil_a4nlabs, Aug 31, 2016.

  1. senthil_a4nlabs

    senthil_a4nlabs New Member

    Joined:
    Aug 27, 2016
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Gender:
    Male
    how we reverse a string in an array give me the programme
     
  2. ahmedsabuwala12

    ahmedsabuwala12 New Member

    Joined:
    Aug 25, 2016
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Gender:
    Male
    Code:
    #include<stdio.h>
    #include<conio.h>
    main()
    {
        char str[10];
        int len, i;
        printf("\n Enter a string:");
        scanf("%s", str);
        len=strlen(str);
        for(i=len-1; i>=0; i--)
        {
            printf("%c", str);
        }
        getch();
    }
    
     

Share This Page