Thanx bigtamscot. But since i am new to this. i am unable to follow ur code.
Code:
#include <stdio.h>
#include <string.h>
#include <conio.h>
void xstrcpy(char *s);
int main()
{
char s[80];
printf("Enter the string\n");
scanf("%s",s);
xstrcpy(s);
getch();
return 0;
}
void xstrcpy(char *s)
{
char s1[80], *s2;
s2=s1;
while(*s!='\0')
{
*s2=*s;
s2++;
s++;
}
*s2='\0';
printf("S1 = %s",s1);
}
I have done this. is this correct. Can u explain to me the part where u checking if the string is less than 80 characters?
Thanx