Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*********************************
- * Class: MAGSHIMIM C2 *
- * Week: *
- * Name: *
- * Credits: *
- **********************************/
- #include <stdio.h>
- #define SIZE 11
- void printAfterX(int* arr, int n, int* x);
- int main(void)
- {
- int arr[] = { 4 ,8 ,6 ,2 ,1 ,3 ,5 ,7 ,8 ,9 ,5 };
- int offset = 0;
- printf("Please enter an offset to search in the array's address domain: ");
- scanf("%d", &offset);
- printAfterX(arr, SIZE, arr + offset);
- getchar(); //Cleaning the buffer
- getchar();
- return 0;
- }
- /*
- Function that print from the array after x
- input: the arr the size of the arr and the x
- output:none
- */
- void printAfterX(int* arr, int n, int* x)
- {
- if (x < arr || x > n + arr)
- {
- printf("Not in the array.\n");
- }
- else
- {
- for (x = x + 1; x < n + arr; x += 1)
- {
- printf("%d ", *x);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement