Skip to main content
gamedev.net
🔒 Locked

pointer question

Started by Lode Dec 28, 2004 at 7:19 AM 1 replies 350+ views
Original Post
Lode
Lode
Does pointer = &pointerToMyObject[5]; do the same as pointer = pointerToMyObject + 5 * sizeof(MyClass); where pointerToMyObject points to the 10th element of a large enough array of type MyClass?
Lode
Lode
Quote:
Original post by DrEvil
you dont need to use sizeof(), incrementing a pointer will increment it by the size of the type its pointing to.


Thanks. Then that explains some weird behaviour and memory-related crashes :D

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.