cstut10 - Function isPalindrome1 to check if a string is a...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Using string need #include <string.h> Strings are just a specific form of arrays. Like in functions, int [ ], now is char [ ] Scanf a string, instead of %d, write %s Size of the string = the actual size +1 (for ‘\0’) Printf prints 1 if it is palindrome, 0 if it is not
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Function isPalindrome1 to check if a string is a palindrome Function reverse to reverse a string. Only up to strlen/2, or else reverses twice. Function swap for function reverse. Checking palindrome based on left-right character matches...
View Full Document

This note was uploaded on 01/09/2012 for the course ELECTRICAL 1221 taught by Professor Tan during the Spring '11 term at National University of Singapore.

Page1 / 2

cstut10 - Function isPalindrome1 to check if a string is a...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online