trying to insert data into the middle of an array

when i try to display the altered string after my modifications it gets put out in ascii and says data around the stack was corrupted. heres the function

1
2
3
4
5
6
7
8
9
10
11
12
13
14
void SpaceAfterPeriod( char Paragraph[])
{
	char temp[500];
	int offset(0);

	strcpy ( Paragraph, temp );
	for ( int i = 0; i < Paragraph[i] + offset; i++ )
	{
		Paragraph[i + offset] = temp[i];
		if ( Paragraph[i + offset] == '.' )
			Paragraph[i + ++offset] = ' ';
	}
	cout << Paragraph << endl;
}


Topic archived. No new replies allowed.