How to write a C Program to Find max and min in array using pointer concept in C Programming Language ?
This C Program to Find maximum and minimum in array using pointer concept.
Solution:
- /*C Program to find maximum and minimum element in array using pointer */
- #include <stdio.h>
- #include <stdlib.h>
- void max_min(int num[],int length,int *max,int *min);
- int main()
- {
- int len;
- int num[len];
- int i,max,min;
- printf("How many numbers do you wanna input ?");
- scanf("%d",&len);
- printf("Enter %d numbers to find the biggest and small (enter x to terminate)",len);
- for(i=0;i<len-1;i++)
- {
- scanf("%d",&num[i]);
- }
- max_min(num,len,&max,&min);
- printf("Biggest number :%d",max);
- printf("Smallest number :%d",min);
- system("pause");
- return 0;
- }
- void max_min(int num[],int length,int *max,int *min)
- {
- int k;
- for(k=0;k<length-1;k++)
- {
- if(num[k]>*max)
- *max=num[k];
- else if(num[k]<*min)
- *min=num[k];
- }
- }
Learn More :
Maximum
- Write a C program to find maximum or equal between two numbers ?
- How to Write a C program to find maximum between two numbers ?
- Write a C program to find maximum between three numbers ?
- C program to Given a vector (integer or real), determine what is the maximum value of element what is the position in which this element is located
- C Program To Find The Maximum And Minimum Value In An Array
- C Program To Find Maximum Of Given Numbers
- Max count of chars, Max count of nums and Max count of signs
- C Program to Print Maximum and Minimum Number in Row and Column
- C Program to accept n numbers from user & find out the maximum element out of them by using dynamic memory allocation
- C Program to accept n numbers from user, store these numbers into an array. Find out Maximum & Minimum number from an Array
Pointer
- C Program Pointer Example
- C Program To Reverse The String Using Pointer
- C Program to Adds literal to list of literals
- C Program to find smallest in an array using pointer
- C Program A simple demonstration of using pointers to determine which function to use
- C Program LEXICAL ANALYSER
- C Program Simple linked list
- File Handling (console to file) in C Program
Minimum
- C Program To Find The Maximum And Minimum Value In An Array
- Max count of chars, Max count of nums and Max count of signs
- C Program to Print Maximum and Minimum Number in Row and Column
- C Program to accept n numbers from user, store these numbers into an array. Find out Maximum & Minimum number from an Array
Array
- How to pass one dimensional array to function in c.
- Write a c program which passes two dimension array to function.
- C Program Array Index Example
- C Program Array Example: Average
- C Program Array Example: Reverse
- C Program Array Example
- C Program to Array
- C Program Array NxM Elements Geometric/Arithmetic
- C Program To Find The Maximum And Minimum Value In An Array
- C Program To Find Union & Intersection Of Two Array
- C Program To Search A Number Inside The Array
- C Program To Sort An Array In Ascending And Descending Order
- C Program To Sort An Array Of Names In Alphabetical And Reverse Order
- C Program To Copy One Character Array Into Another
- Returns: array of decoded values. [0] - count of values
- C Program to Check if a number is in an array[1000]
- C Program Sort Array By Segment
- C Program to sort an array using bubble sort
- C Program to find smallest in an array using pointer
- C Program to merge and sort two arrays
- Un-sortiertes Array and Sortiertes Array
- C Program to Array Deserialization
- C program calculates a given function in range given by user, stores the data in arrays and displays the answer in a table.
- Input reads in the array positions and range for random generation.
Find
- Find out the perfect number using c program
- Find g.c.d of two number using c program.
- Write a c program to find out NCR factor of given number
- How to Write a C program to find maximum between two numbers ?
- Write a C program to find maximum between three numbers ?
- C or C++ program to read marks of 4 subjects and find how many students are pass and fail with division
- C Program turnLEDOn to Drives Forward Until It Finds The Line
- Write overloaded function templates for finding the roots of the linear (a * x + b = 0) and square (a * x2 + b * x + c = 0) uravneniy.Zamechanie: in function to send coefficients of the equations.
- C Program to Find Random Number
- C Program To Find LCM and HCF Of Two Number Using Function - 2
- C Program to find LCM and HCF Of Two Number Using Recursion - 3
- C Program To Find LCM and HCF Of Two Number -1
- C Program To Find Length Of A String Including Blank Spaces, Tabs, And Other Special Characters
- C Program To Find Length Of String And Concatenate Two Strings
- C Program To Find Product Of Two No Using MACRO
- C Program To Find Reverse Of Any Digit Number
- C Program To Find Sum and Difference Of Two Matrices
- C Program To Find The Frequency Of A Number
- C Program To Find The Length, Reverse Of A String And To Check It Is Palindrome or Not
- C Program To Find The Maximum And Minimum Value In An Array
- C Program To Find Transpose Of A Matrix
- C Program To Find Union & Intersection Of Two Array
- C Program Finding the sum of Squares using Recursion
- C Program to Find NCR Of A Given Number Program
- C Program To Find Maximum Of Given Numbers