#include<string.h>
#include<stdlib.h>
#include<stdio.h>
/* function prototype */
char a[10]="string";
char b[10];
void *rev();
int main()
{
char *p;
/* function call*/
p=rev();
printf("rev e string id %s\n",p);
return 0;
}
/* function defination*/
void *rev()
{
int l=0;
char *r,*q;
q=a;
r=b;
l=strlen(q);
q=q+(l-1);
while(l>=0)
{
*r=*q;
r++;
q--;
l--;
}
return (b);
}
No comments:
Post a Comment