{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# tutorial7 - in the address(in the function minFrac itself...

This preview shows pages 1–2. Sign up to view the full content.

In void reorder, even though the input are addresses, we don’t use *minFrac(*a,*b) == *b because a = &s, b = &m minFrac (&s, &m) = minFrac (a, b) swap (&s, &m) = swap (a, b) if (*minFrac(&s, &m) == &m = if (minFrac(a, b) == b) a and b are addresses, minFrac also an address. So we must compare address with address, since b is address, we use minFrac, not *minFrac But even though minFrac is an address, the function minFrac itself checks the values

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: in the address (in the function minFrac itself, because in the function minFrac we dereference the addresses with *) Important: (*count)++! *count++ will not work. Need the brackets. This is the best & shortest way of finding gcd int gcd (int a, int b) { int c; While (b!=0) { c= a%b; a=b; b=c; } Return a; }...
View Full Document

{[ snackBarMessage ]}