c - Segmentation fault Core dumped on virtual machine -


in function, created following char array.

char key1[500]=""; 

i looping through index "i" in function , copying values of inputfilearray global variable through index initialindex (a global index).

key1[i++]= inputfilearray[initialindex++]; 

this statement resulting in error segmentation fault(core dumped) when run.

btw, worked fine on machine in compiled using visual studio c++ editor. error when try run on ubuntu 13.10 on virtual machine. appreciate answers.

this statement resulting in error segmentation fault(core dumped) when run.

learn use debugger (usually gdb on linux). may want start here.

run program under debugger, , verify i < 500 , that
initialindex < sizeof(inputfilearray).

this worked fine on machine

yes, bugs that: code works fine (appears work fine) on 1 machine crashes on next.


Comments

Popular posts from this blog

jQuery Mobile app not scrolling in Firefox -

c++ - How to add Crypto++ library to Qt project -

php array slice every 2th rule -