putting mem address in pointer array

I am running the following code to try and copy the memory address of current location of string when an initial lower [a-z] are discovered. It works okay except the the line that is suppose to put current memory address of sentence[j] in the pointer as a future reference. The line *memoryBlock = &sentence[j];
is putting the entire sentence in memoryBlock. Any thoughts


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

counter = 0;
	j = 0;
	memoryBlock = memoryBlockAlias;
	for (j = 0; j < (sentence._Mysize); ++j) /*strlen(sentenceAlias.c_str()-1)*/
	{
		
		if (sentence[j] >= 0x061 && sentence[j] <= 0x07a)
		{
			*memoryBlock = &sentence[j];    
			counter++;

			cout << "\nmemoryBlock   " << memoryBlock << endl;
			cout << "\n&memoryBlock   " << &memoryBlock << endl;
			cout << "\n*memoryBlock   " << *memoryBlock << endl;

		}
		while (sentence[j] >= 0x061 && sentence[j] <= 0x07a && (j < (sentence._Mysize)))
			j++;
	}
Last edited on
Topic archived. No new replies allowed.