Most text manipulation is accomplished with iterators, represented by a gtk-text-iter. An iterator represents a position between two characters in the text buffer. gtk-text-iter is a structure designed to be allocated on the stack; it is guaranteed to be copiable by value and never contain any heap-allocated data. Iterators are not valid indefinitely; whenever the buffer is modified in a way that affects the number of characters in the buffer, all outstanding iterators become invalid. Note that deleting 5 characters and then reinserting 5 still invalidates iterators, though you end up with the same number of characters you pass through a state with a different number.