any idea why i get 0.0000 printed out for slength instead of my wanted value?
Code:... int main(void) { struct Segment seg; double seglength(); double slength; do { /* request 1st point coordinates */ printf("\nEnter first point coordinates x1 y1: "); scanf("%d" "%d" , &seg.x1 , &seg.y1); /* Flush keyboard buffer */ fflush(stdin); /* request 2nd point coordinates */ printf("\nEnter second point coordinates x2 y2: "); scanf("%d" "%d" , &seg.x2 , &seg.y2); /* Flush keyboard buffer */ fflush(stdin); /* Print length of segment */ printf("Segment length:%.5f" , slength); } while(OKtoContinue()); return 0; } double seglength(struct Segment seg) { double slength; slength = sqrt((seg.x2 - seg.x1) * (seg.x2 - seg.x1) + (seg.y2 - seg.y1) * (seg.y2 - seg.y1)); return slength; }