What did you expect it to print? I suspect you want to move the 'printf' line above the brace preceding it (i.e. change
Code:
if (packet_duration > 0) {
packet_no++;
total_delay = total_delay + packet_duration;
}
}
printf("%d %f %f\n", packet_no, total_delay, total_delay/packet_no);
}
to
Code:
if (packet_duration > 0) {
packet_no++;
total_delay = total_delay + packet_duration;
}
printf("%d %f %f\n", packet_no, total_delay, total_delay/packet_no);
}
}
Also, use [CODE][/CODE] tags around your code to make it more legible.