Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdint.h>
- static uint16_t base[] = {1,2,3,4,5,6,7,8,9,10};
- static uint16_t pattern[] = {4,5};
- int8_t startIdx (uint16_t *table, uint8_t tblSize, uint16_t *match)
- {
- for (int8_t idx =0; idx < tblSize-1; idx++)
- if (table[idx] == match[0] && table[idx+1] == match[1])
- return idx;
- return -1;
- }
- int main()
- {
- printf("%d\n", startIdx(base, 10, pattern));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement