Write a program to find the numbers in an array that are bigger than 50 using pointers.

Photo by Jess Bailey on Unsplash

Write a program to find the numbers in an array that are bigger than 50 using pointers.

In this article, we will see how we can go through an array and find the numbers that are greater than 50

#include <stdio.h>

void bigg(int *x);
int main()
{
    int i;
    int a[10];

    printf("enter the number: ");
    for (i = 0; i<=9; i++)
    {
        scanf("%d",&a[i]);
    }

     bigg(a);


}

void bigg (int *x)
{
    int i,c;

    c = 0;

    for (i = 0; i<=9; i++)
    {

        if (*(x + i) > 50) 
        {

               c = c + 1;
        }    

    }
    printf("The number which are bigger than 50 are:%d",c);
}

INPUT:

34
45
67
89
34
23
87
12
43
2

OUTPUT:

The number which are bigger than 50 are:3