Language: C++

#include <bits/stdc++.h>
#include <numeric>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

void trace(vector<int> a(),int n){
    for(int i=0;i<n;i++){
        if(i>0) cout << " " << a[i];
    }
    cout << endl;
}

void insertionsort(vector<int> a(),int n){
    int j,v;
    for(int i=1;i<n;i++){
        v=a[i];
        j=i-1;
        while(j>=0&&a[j]>v){
            a[j+1]=a[j];
            j--;
        }
        a[j+1]=v;
        trace(a,n);
    }
}

int main(){
    int n,i,j;
    vector<int> a(n);
    cin >> n;
    for(int i=0;i<n;i++) cin >> a[i];
    trace(a,n);
    insertionsort(a,n);
    return 0;
}



Compiler output:
a.cc: In function 'void trace(std::vector<int> (*)(), int)':
a.cc:10:35: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   10 |         if(i>0) cout << " " << a[i];
      |                                   ^
a.cc: In function 'void insertionsort(std::vector<int> (*)(), int)':
a.cc:18:14: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   18 |         v=a[i];
      |              ^
a.cc:18:14: error: invalid conversion from 'std::vector<int> (*)()' to 'int' [-fpermissive]
   18 |         v=a[i];
      |           ~~~^
      |              |
      |              std::vector<int> (*)()
a.cc:20:24: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   20 |         while(j>=0&&a[j]>v){
      |                        ^
a.cc:20:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   20 |         while(j>=0&&a[j]>v){
      |                     ~~~~^~
a.cc:21:18: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   21 |             a[j+1]=a[j];
      |                  ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:21:23: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   21 |             a[j+1]=a[j];
      |                       ^
a.cc:21:19: error: assignment of read-only location '*(a + (((sizetype)j) + 1))'
   21 |             a[j+1]=a[j];
      |             ~~~~~~^~~~~
a.cc:24:14: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   24 |         a[j+1]=v;
      |              ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:24:15: error: assignment of read-only location '*(a + (((sizetype)j) + 1))'
   24 |         a[j+1]=v;
      |         ~~~~~~^~
a.cc: In function 'int main()':
a.cc:34:11: error: cannot convert 'std::vector<int>' to 'std::vector<int> (*)()'
   34 |     trace(a,n);
      |           ^
      |           |
      |           std::vector<int>
a.cc:8:24: note:   initializing argument 1 of 'void trace(std::vector<int> (*)(), int)'
    8 | void trace(vector<int> a(),int n){
      |            ~~~~~~~~~~~~^~~
a.cc:35:19: error: cannot convert 'std::vector<int>' to 'std::vector<int> (*)()'
   35 |     insertionsort(a,n);
      |                   ^
      |                   |
      |                   std::vector<int>
a.cc:15:32: note:   initializing argument 1 of 'void insertionsort(std::vector<int> (*)(), int)'
   15 | void insertionsort(vector<int> a(),int n){
      |                    ~~~~~~~~~~~~^~~