Does new[] allocate memory contiguously?

Viewed 992

When I use the new[] keyword (or new-operator), does it allocate memory contiguously?

int* arr = new int[10];

I mean, is there any guarantee, that arr[0] and arr[1] are closely placed, and I can iterate through the arr using pointer increments? If so, does this behavior save with structs and classes instead of int?

2 Answers
Related