为什么运行之后没显示错误但没有输出呢

请问我这个选择法+函数+数组排序哪里错了吗,他为什么运行之后没显示错误但没有输出呢?


#include 
using namespace std;
void sort(int a[],int n);
int main()
{
    int n;
    int i;
    int a[i];
    cout<<"输入数组元素"<>a[i];
    n=sizeof(a)/sizeof(a[0]);  
    cout<<"before"<for(i=0;i"after"<sort(a,n);
    return 0;
}
void sort(int a[],int n)
{
    for(int i=0;i-1;i++)
    {
        for(int j=i+1;j-1;j++)
        {
            if(a[i]>a[j])
            {
                int t=a[i];
                a[i]=a[j];
                a[j]=t;
            }
        }
    }
    
}

img

int a[i]这里的i未知,数组大小未知