## C Program to find a larger number between two numbers.

Code:

```#include<stdio.h>
int *Large(int *, int *);
int main()
{
int a=5,b=10,*p;
p = Large(&a,&b);

printf("Larger number between %d and %d is %d.",a,b,*p);
}
int *Large(int *x, int *y)
{
if(*x>*y)
return (x);
else
return (y);
}```

Output:

`Larger number between 5 and 10 is 10.`

## C Program to Access Array Elements Using Pointer

Code:

```#include <stdio.h>
int main()
{
int array[5];
printf("Enter values : ");
for (int i = 0; i < 5; ++i)
scanf("%d", array + i);

printf("Elements of Array: \n");
for (int i = 0; i < 5; ++i)
printf("Element[%d] = %d\n", i, *(array + i));
return 0;
}```

Output:

```Enter values : 1
2
3
4
5
Elements of Array:
Element[0] = 1
Element[1] = 2
Element[2] = 3
Element[3] = 4
Element[4] = 5```

## C Program Swap Numbers in Cyclic Order Using Call by Reference

Code:

```#include <stdio.h>
void Swap(int *x, int *y, int *z);
int main()
{
int x, y, z;
printf("Enter first value: ");
scanf("%d", &x);
printf("Enter second value: ");
scanf("%d", &y);
printf("Enter third value: ");
scanf("%d", &z);
printf("Before swapping:\n");
printf("x = %d \ny = %d \nz = %d\n", x, y, z);
Swap(&x, &y, &z);
printf("After swapping:\n");
printf("x = %d \ny = %d \nz = %d\n", x, y, z);
return 0;
}
void Swap(int *a, int *b, int *c)
{
int temp;
temp = *b;
*b = *a;
*a = *c;
*c = temp;
}```

Output:

```Enter first value: 1
Enter second value: 2
Enter third value: 3
Before swapping:
x = 1
y = 2
z = 3
After swapping:
x = 3
y = 1
z = 2```

## C Program to Find Largest Number Using Dynamic Memory Allocation

Code:

```#include <stdio.h>
#include <stdlib.h>
int main()
{
int number;
float *value;
printf("Enter number of values: ");
scanf("%d", &number);
value = (float *)calloc(number, sizeof(float));
if (value == NULL)
{
printf("Memory not allocated");
exit(0);
}
for (int i = 0; i < number; ++i)
{
printf("Value %d: ", i + 1);
scanf("%f", value + i);
}
for (int i = 1; i < number; ++i)
{
if (*value < *(value + i))
*value = *(value + i);
}
printf("Maximum value is %.2f\n", *value);
return 0;
}```

Output:

```Enter number of values: 4
Value 1: 10
Value 2: 20
Value 3: 30
Value 4: 40
Maximum value is 40.00```