Sachin
Sachin

Reputation: 11

ld.exe cannot open output file E:\CLG WRK\cpp\Reverse.exe: Permission denied, [Error] ld returned 1 exit status

I am working on an array problem in which I have to reverse an array. I wrote this code but it is not working:

#include<iostream>
using namespace std;

void rev(int reversed_array[], int arr[], int n)
{
    for(int i=0;i<n;i++)
        {
            reversed_array[i]=arr[i];
        }
}

int main()
{
    int arr[]={11,2,3,4,5};
    int n;
    n= sizeof(arr)/sizeof(arr[0]);
    int reversed_array[n];

    rev(reversed_array,arr,n);

    cout<<reversed_array[0];
    return 0;
}

It gives me error like:

ld.exe  cannot open output file E:\CLG WRK\cpp\Reverse.exe: Permission denied 
[Error] ld returned 1 exit status

I tried:

  1. Restarted my IDE -> No difference
  2. Used online compiler -> No errors but shows the wrong output(11, instead of 5)

Here is an IDE Screenshot

Upvotes: 0

Views: 34

Answers (0)

Related Questions