Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication24.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- int _tmain(int argc, _TCHAR* argv[])
- {
- int a[8]={10,3,5,6,20,44,66,8};
- int x=10,i;
- bool isFound=false;
- //for ( i=0;i<8;i++)
- // if (a[i]==x) {
- // isFound=true;
- // break;
- // }
- int *pos=a, *end=a+9;
- do
- {
- if (*pos==x)
- {
- isFound=true;
- break;
- }
- } while (++pos<end);
- if (isFound)
- printf("Yes! pos=%d\n",pos-a);
- else
- printf("No!\n");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement