c++ - I am getting thread1:SIGNAL sigbart in output -


this code, please me ! im using xcode.. want generate sequence polynomial , terms xor'ed , made feedback first input bit since 8 bit done 2^8-1 times.alternate code helpful in advance

#include "32bit.h" #include<iostream>  using namespace std; int main() {     bool input[8];     int n;     bool out=0;     cout<<"enter no of terms ";     cin>>n;     int temp1[n];     int gen=0;     bool store[255];     cout<<"input power of x in increasing order, omit x^0";       for(int i=0;i<n;i++)         cin>>temp1[i];     cout<<"enter key generate ";     cin>>gen;     for(int m=0;m<255;m++)     {         store[m]=input[gen];         bool temp2[n];         int var=0;         for(int j=0;j<n;j++)         {              var=temp1[j];             temp2[j]=input[var];         }         int c=0;         for(int k=0;k<n;k++)         {             if(temp2[k]%2==1)                 c++;          }         if(c%2==1)             out=1;         else             out=0;         for(int l=0;l<8;l++)             input[l+1]=input[l];         input[0]=out;     }     for(int p=0;p<255;p++)         cout<<store[p]; } 

there out of bounds array access here:

    for(int l=0;l<8;l++)         input[l+1]=input[l]; 

since input of size 8 , trying write input[8] (i.e. non-existent 9th element) on last iteration of loop. i'm guessing should be:

    for(int l=0;l<7;l++)         input[l+1]=input[l]; 

Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -