#include<stdio.h>
#include<string.h>
void reverse_string(char *s)
{
int len = strlen(s);
int i,j;
i=0;
j=len-1;
while(i < j)
{
char tmp = s;
s = s[j];
s[j] = tmp;
i++;
j--;
}
}
int main()
{
char s[100] = "abcdefg";
char t[100];
strcpy(t,s);
reverse_string(s);
if(strcmp(t,s) == 0)
printf("Yes");
else
printf("No");
return 0;
}
a) Copies a string to another string
b) Compares two strings
c) Reverses a string
d) Checks if a string is a palindrome
What does the following code do?
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
What does the following code do?
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!