title: C++ - Program received signal SIGSEGV, Segmentation fault.In msvcrt!memcpy () (C:\Windows\System32\msvcrt.dll)
body: <p>I'm getting back to c++ and I'm using code::blocks. Everything was going fine but out of nowhere I started to get this error </p>
  
  <blockquote>
    <p>'<code>Program received signal SIGSEGV, Segmentation fault.In msvcrt!memcpy () (C:\Windows\System32\msvcrt.dll)</code>'</p>
  </blockquote>
  
  <p>The code compiles with no errors, but when I choose the option 1 "[1] - ... " it throws that error.</p>
  
  <p>I googled a bit but I couldn't find anything related or that could help me fix this problem.</p>
  
  <p>My code it's this:</p>
  
  <pre><code>    #include &lt;iostream&gt;
      #include &lt;stdlib.h&gt;
      #include &lt;string&gt;
  
      using namespace std;
  
      int SeeData();
      int ChangeData();
      string AddTodo();
  
      class Data {
       public:
        string name;
        string surname;
        string age;
        string salary;
        string todo[];
      };
  
      string dataArr[] = {"Bernardo", "Piedade", "19", "540.50"};
      string todoArr[] = {"Create new functions"};
  
      int sizeOfTodoArr = sizeof(todoArr) / sizeof(*todoArr);
  
      int main() {
        int _menuInput;
        while (_menuInput != 0) {
          cout &lt;&lt; "[1] - See data\n[2] - Change data\n[3] - Add TODO\n[0] - "
                  "Exit\n\n&gt;&gt;";
          cin &gt;&gt; _menuInput;
  
          if (_menuInput == 1) {
            SeeData();
          } else if (_menuInput == 2) {
            ChangeData();
          } else if (_menuInput == 3) {
            AddTodo();
          } else if (_menuInput == 0) {
            system("exit");
          } else {
            cout &lt;&lt; "Option not available";
            system("cls");
          }
        }
  
        return 0;
      }
  
      int sizeOfData = sizeof(dataArr) / sizeof(*dataArr);
  
      int SeeData() {
        Data _myData;
  
        _myData.name = dataArr[0];
        _myData.surname = dataArr[1];
        _myData.age = dataArr[2];
        _myData.salary = dataArr[3];
  
        string person[sizeOfData];
  
        for (int i = 0; i &lt; sizeOfTodoArr; i++) {
          _myData.todo[i] = todoArr[i];
        }
  
        for (int i = 0; i &lt; sizeOfData; i++) {
          person[i] = dataArr[i];
        }
  
        for (int i = 0; i &lt; sizeOfData; i++) {
          cout &lt;&lt; "Name: " &lt;&lt; person[0] &lt;&lt; "\nSurname: " &lt;&lt; person[1]
               &lt;&lt; "\nAge: " &lt;&lt; person[2] &lt;&lt; "\nSalary: " &lt;&lt; person[3] &lt;&lt; "\n\n";
          cout &lt;&lt; "Todo List: \n\t";
  
          for (int j = 0; j &lt; sizeOfTodoArr; j++) {
            cout &lt;&lt; "\n\t" &lt;&lt; todoArr[j];
          }
        }
      }
  
      int ChangeData() {}
  
      string AddTodo() {}
  
  </code></pre>
  
  <p>Edit: As u/Uninitialized said, the error was happening because the array todo[] didn't had a starting size.</p>