Created
April 17, 2021 19:41
-
-
Save Kimxons/cf172282985a79f65c33cd40bcd02bb6 to your computer and use it in GitHub Desktop.
Revisions
-
Kimxons created this gist
Apr 17, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ #include<stdio.h> #include<string.h> void palindrome(char str[]) { int leftmost_index = 0; int rightmost_index = strlen(str) - 1; while(rightmost_index > leftmost_index) { if(str[leftmost_index++] != str[rightmost_index--]) { printf("%s not a palindrome\n", str); return; } } printf("%s is a palindrome\n", str); } int main() { palindrome("mom"); return 0; }