Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #define strcmpi strcasecmp
- int main () {
- int numbers[] = {5,7,2,8,4,3,1,0,6,9};
- char names[10][255] = {
- "Emily",
- "Jessica",
- "Megan",
- "Chloe",
- "Charlotte",
- "Sophie",
- "Rebecca",
- "Hannah",
- "Ellie",
- "Georgia"
- };
- int isFound = 0;
- char target[255] = "Ellie";
- for (int i = 0 ; i < 10 ; ++i) {
- if ( !strcmp(names[i], target) ) {
- isFound = 1;
- break;
- }
- }
- // int target = 10;
- // int length = sizeof(numbers) / 4;
- // for (int i = 0 ; i < length ; ++i) {
- // if (target == numbers[i]) {
- // isFound = 1;
- // break;
- // }
- // }
- printf("%sFOUND", isFound ? "" : "NOT ");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement