error
/bin/run.sh: line 4: 18 Segmentation fault (core dumped) ./exe
code
error
/bin/run.sh: line 4: 18 Segmentation fault (core dumped) ./exe
code
made some changes plz look
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
int A[100],n,no;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>A[i];
}
cin>>no;
sort(A,A+n);
cout<<"sorting done"<<endl;
for(int i=0;i<n;i++)
{
cout<<A[i]<<",";
}
for(int i=0;i<n;i++)
{
int k=i+1;
int j=n-1;
while(k<j)
{
int m=no-A[i];
if(A[k]+A[j]==m)
{
k++;
j--;
cout<<A[i]<<","<<A[k]<<" and "<<A[j]<<endl;
}
else if(A[k]+A[j]>m)
{
j--;
}
else if(A[k]+A[j]<m)
{
k++;
}
}
}
return 0;
}
getting same error
segmentation fault
i am getting same error
What is the max size of array given in constraints.?
constraint : 1 to 1000
And what have u entered 