Skip to content

Commit 00b966d

Browse files
author
Colin Robertson
committed
Fix issue 2053 runtime error in raw ptr sample
1 parent 00d0d57 commit 00b966d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

docs/cpp/raw-pointers.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,8 @@ int main()
272272

273273
// use operator new to allocate untyped memory block
274274
void* pvoid = operator new(1000);
275-
for(char* c = static_cast<char*>(pvoid); pvoid < &pvoid + 1000; ++c)
275+
char* pchar = static_cast<char*>(pvoid);
276+
for(char* c = pchar; c < pchar + 1000; ++c)
276277
{
277278
*c = 0x00;
278279
}

0 commit comments

Comments
 (0)