up samplecode with struct