Skip to content
Skanda2007 edited this page Nov 16, 2021 · 3 revisions

#include <stdio.h>

int main() { int a[5]; Declaring the array int *arr; Declaring the pointer variable for(int i=0;i<=4;i++) Input of Numbers for array a from User { printf("Enter Number %d: ", i+1); scanf("%d", &a[i]); } arr=&a[0]; Initialize tha pointer to first element in array for(int i=0;i<=4;i++) { if(*arr>a[i]) if value of the pointer is more than the value of the current variable then replace the value of the pointer to the current array value { arr= &a[i]; } } printf("-------------------------------\n"); printf("min : %d\n", *arr); printing the value of pointer printf("-------------------------------\n"); printf("address of min: %p", arr); print the address from pointer }

Clone this wiki locally