Pointer and string programs in C
// program to reverse a string using function where we use pointer to character
//WAP to reverse a string using(strrev()) function.Pass string as parameter and return its reverse
#include <stdio.h>
#include<string.h>
#include<conio.h>
char *stringrev(char string[]);
/* function named stringrev() that accepts a string and returns
a char(i.e. pointer to character/string)
int main()
{
char name[100];//string declaration
printf("enter string\n");
scanf("%[^\n]",name);
printf("reverse=%s\n",stringrev(name));//prints the name
getch();
return 0;
}
char *stringrev(char string[])
{
strrev(string);
return string;
}