CPP
cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
using namespace std;
//Program to show use of array of function pointers
//An auxiliary function to return absolute value
int abs(int);
//Different function generating diamond * pattern in different ways
void diamond_1(int);
void diamond_2(int);
void diamond_3(int);
void diamond_4(int);
void diamond_5(int);
int main() {
//Array of pointers to functions
//My functions don't return anything so void it can be any valid data type otherwise
void (* arr[])(int a) =
{
diamond_1,
diamond_2,
diamond_3,
diamond_4,
diamond_5
};
//Modify size to get diamond of different size
int SIZE=9;
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run