Thread: string reversing function strrev() errors

  1. #1
    Registered User
    Join Date
    Jan 2011
    Posts
    113

    string reversing function strrev() errors

    I used strrev() to reverse a string ..
    Code:
    # include <stdio.h>
    # include <string.h>
    
    int main (void)
    {
      char str[50];
    
      fputs("enter",stdout);
      fgets(str, sizeof(str),stdin); strrev(str);
      fputs(str,stdout);
    }
    .. its showing the following error
    PHP Code:
    /tmp/cc6O6bIr.oIn function `main':
    reversew.c:(.text+0x62): undefined reference to 
    `Strrev'
    collect2: ld returned 1 exit status 

  2. #2
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    strrev() is not a standard function.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  3. #3
    Registered User
    Join Date
    Jan 2011
    Posts
    113
    actually i use gnu c ....
    I referred the first link that you mentioned but couldn't find any standard function that reverses a string.. what I should use.
    Actually I referred a text book in which strrev() is mentioned to reverse a string..

  4. #4
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Some Linux implementations may well have it, but it's not standard, and if you don't have it and you need it that means you have to write it.

  5. #5
    Registered User
    Join Date
    May 2010
    Location
    Naypyidaw
    Posts
    1,314
    reversew.c.text+0x62): undefined reference to `Strrev'

    Did you just copy/paste the error or type in??! Notice the 'S'trrev

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 06-01-2010, 08:28 PM
  2. reverse string without using strrev() function
    By revolution3396 in forum C Programming
    Replies: 3
    Last Post: 11-27-2008, 02:34 AM
  3. Reversing a c-string with a function
    By patricio2626 in forum C++ Programming
    Replies: 3
    Last Post: 04-01-2007, 11:00 PM
  4. Reversing a string
    By gandamkumar in forum C++ Programming
    Replies: 16
    Last Post: 11-27-2004, 10:09 PM
  5. trying not to use strrev() function
    By Unregistered in forum C Programming
    Replies: 5
    Last Post: 10-21-2001, 03:05 PM

Tags for this Thread