Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- int linearSearch(char array[][14], char key[], int size )
- {
- int i;
- for ( i = 0; i < size; ++i ) {
- if (strcmp(array[i],key) == 0) {
- return i;
- }
- }
- return -1;
- }
- int main (void) {
- char dstring[1][14];
- char hello[14] = "hello";
- dstring[0] = hello;
- printf("Result: %d", linearSearch(dstring, hello, 1));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement