answersLogoWhite

0

Answer
  1. First find the end of the string.
  2. Then compare the first character to the last character, and if they are different the string is not a palindrome.
  3. Then go the next pair of characters and do # 2 until you reach the middle
Here's a quick and dirty example:

int ispalindrome(const char *s)
{
const char *end = s;
while (*++end)
;

while (end > s)
if (*--end != *s++) return 0;


return 1;

}

This example doesn't skip punctuation or spaces, and it compares letters case sensitively. You are more than welcome to use and improve upon this example.

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

What is a javascript tutorial?

A JavaScript tutorial contains instructions that will teach you how to code in JavaScript.


Is jQuery a high level language?

jQuery is like an advanced JavaScript code. jQuery is a JavaScript code library that gives you more features with less code that what Javascript would require. If you understand JavaScript, jQuery wouldn't be much of a change.


How can you script your ASP code in JavaScript?

Start the document with: <%@ language="javascript" %>


How do you add a click event to a java button?

we can do this using of javascript. you can use this following code: <input type=button value="button" onClick=onclick_function()> here onclick_function() is a function which is called by javascript on clicking the button. javascript code is as follows: <script language="javascript" type="text/javascript"> // your code for onclick_function() function onclick_function(){ alert("Welcome to javascript"); } </script>


What is the javascript code for gaiaonline?

javascript: document.body.contentEditable = 'true'; document.designMode = 'on'; void 0


How do you get the popup javascript box?

Use confirm or alert in javascript code to get a popup


What is the code for JavaScript?

JavaScript code looks like this:function sayhi(name) {alert("Hey there, "+name);}sayhi("joe");


Why is your javascript not working?

If there is no actual error in the code itself, most likely javascript is disabled in the browser.


What is Code for palindrome using stack?

poooda


How can footstool be considered a Palindrome?

in morse code


How do you save javascript on Roblox?

It is not possible to save and execute Javascript code on Roblox. You can save Javascript code as plain text in script objects, but there is no way to execute the code. Roblox uses a scripting language called LUA in-game which is somewhat similar to JavaScript, but it is not identicle. You can learn about LUA syntax on the Roblox wiki.


How reliable is JavaScript?

As reliable as the code writer.