Your problem is probably here:
for(i=0;i<100;i++){
if(vet[i]>vet[i+1]){
When i=99
, and you access vet[i+1]
, you are off the end of the array. This element is not defined, and it's probably just fluke that you don't get any worse behaviour.
EDIT: So the solution is to change in
for(i=0;i<99;i++){
if(vet[i]>vet[i+1]){