Thread: palindrome

  1. #1
    Registered User
    Join Date
    Feb 2006


    my program is as follows:

    #define size 100
    void main()
    char strsrc[size];
    char strtmp[size];
    printf("\n Enter String:= "); 
    printf("\n Entered string \"%s\" ispalindrome",strsrc);
    printf("\n Entered string \"%s\" is not 
    what i did so far is wait for a user input and then check for palindromes. How do i change it so that I can use a file with a few lines to check each line if it is a palindrome and go on till the eof.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    > void main()
    main returns an int

    > gets(strsrc);
    NEVER use gets, always use fgets()
    See the FAQ.
    Also, when you use fgets(), the answer to how to read from a file becomes pretty self evident, you just replace the stdin with the open file of your choice.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Error in Recursive String Palindrome Code
    By clegs in forum C Programming
    Replies: 13
    Last Post: 12-21-2008, 11:36 AM
  2. Is it a Palindrome?
    By xp5 in forum C Programming
    Replies: 3
    Last Post: 09-06-2007, 05:26 AM
  3. bool palindrome definition
    By justinc911 in forum C++ Programming
    Replies: 3
    Last Post: 11-26-2003, 04:50 PM
  4. Palindrome Coding trouble
    By TheLoneWolf32 in forum C++ Programming
    Replies: 3
    Last Post: 02-22-2003, 06:05 PM
  5. palindrome HELP !!!
    By TED22_8 in forum C Programming
    Replies: 23
    Last Post: 01-22-2002, 01:14 PM
Website Security Test