void strrev(char *r, char
*s) that reverses the string s, putting the result into r.
Hint: the function strlen returns the length of a string. The
function should assume that the calling function has allocated
enough space for r.int ispalindrome(char *s)
that returns 1 if s is a palindrome and 0 otherwise. Hints: the
function strcmp compares two strings. Read the manual page to find
out how it works. You must create a string large enough to hold the
reverse. Do this by dynamically allocating the string with malloc.
After comparing the string to its reverse, free the memory that you
allocated.calvin 8:38pm > ./palindromes 0 0 1 1 2 4 3 9 11 121 22 484 26 676 ...
If you have any doubts, please give me comment...
#include<stdio.h>
#include<string.h>
void strrev(char *r, char *s);
int ispalindrome(char *s);
int main(){
int i;
char s[100], sq[100];
for(i=0; i<1000000; i++){
sprintf(s, "%d", i);
sprintf(sq, "%d", (i*i));
if(ispalindrome(sq))
printf("%s %s\n", s, sq);
}
return 0;
}
void strrev(char *r, char *s){
int len = strlen(s);
int i=0;
while(s[i]!='\0'){
r[len-i-1] = s[i];
i++;
}
r[len] = '\0';
}
int ispalindrome(char *s){
char rev[100];
strrev(rev, s);
if(strcmp(rev, s)==0)
return 1;
return 0;
}
how do i Write a C program called palindromes that prints all integers between 0 and...