mystringreverse

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
void myreverse (char*p )
{
	int a,b=0,l1;
	l1= mylength(p);
	char temp[200];

	for (a=l1-1;a>=0;a--)
	{
		temp[b]=p[a];
		b++;
	}
	for (a=0;a>l1;a++)
	{
		p[a]=temp[a];
	}
	p[l1]='\0';
	
}


this code is not working i think it is logical error

please help for debug
Last edited on
You can debug this by putting cout << temp << endl; at line 11
You need to declare l1 as an int. Also, consider using a variable name that is easier to read than "l1." For example, "|l1|'l1|!."
Topic archived. No new replies allowed.