Using pointer iteration