Starting with Pointers

Hi, I’ve been practicing with arduino for 2 months and Im now introducing myselft to the pointers. I would like to make a programme that shows the user if the sentence that he has introduced is a palindrome or not. Can anyone give me some gidelines?? Thnx

did you google “C palindrome with pointer” ? out of the 747000 answers, I’m pretty sure the first few have relevant ideas…

I’ll give it a view

okay, I have now an idea of how to do it, thanks. Even tho everyone does it writing the sentence in the code and the way I would want to do it is that the user includes the sentence. How should I do this? with an array of chars?

I would suggest to study Serial Input Basics to handle this

I managed to do it using the function .toCharArray() pretty easy :slight_smile:

what if I want to return a sentence introduced by the user with pointers? Any ideas?

Serial Input Basics will let you build a buffer so you can then play with pointers rather than using the String class.

the strcpy() function will let you copy the the cString into a new buffer (but you can do that yourself with a for loop and pointers or just indexes too)

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.