Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for (i = 0; i < n; i++)
- {
- for (j = 0; j < m; j++)
- {
- if (a[i] == b[j])
- {
- goto found;
- }
- }
- /* didnt find any common element */
- }
- found:
- /* got one: a[i] == b[i] */
- ...
- "Code involving a goto can always be written w/o one... the example above becomes..."
- int found = 0;
- for (i = 0; i < n && !found; i++)
- {
- for (j = 0; j < m && !found; j++)
- {
- if (a[i] == b[j])
- {
- found = 1;
- }
- }
- }
- if (found)
- /* got one: a[i-1] == b[j-1] */
- ...
- else
- /* didnt find any common element */
- ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement