Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- char * UserData[4] = { new char[50], new char[50], new char[13], new char[4] };
- char *** phoneBook = new char ** [10];
- phoneBook[0] = UserData;
- gets(UserData[0]);
- gets(UserData[1]);
- gets(UserData[2]);
- gets(UserData[3]);
- cout << phoneBook[0][2] << " Test string 1nn"; // Вывод стоки, здесь все хорошо.
- phoneBook[1] = UserData;
- gets(UserData[0]);
- gets(UserData[1]);
- gets(UserData[2]);
- gets(UserData[3]);
- // Вывод стоки, здесь всё хорошо.
- cout << phoneBook[1][3] << " Test string 2nn";
- // Значение перезаписалось! Почему?
- cout << phoneBook[0][2] << " Test string 1nn WHY IS IT CHANGING???";
- phoneBook[0] = UserData;
- phoneBook[1] = UserData;
- struct phoneBookStruct{
- char UserData0[50];
- char UserData1[50];
- char UserData2[13];
- char UserData3[4];
- }
- phoneBookStruct phoneBook[10];
- gets(phoneBook[0].UserData0);
- gets(phoneBook[0].UserData1);
- gets(phoneBook[0].UserData2);
- gets(phoneBook[0].UserData3);
- cout<<phoneBook[0].UserData0<<" Testing"<<endl;
- gets(phoneBook[1].UserData0);
- gets(phoneBook[1].UserData1);
- gets(phoneBook[1].UserData2);
- gets(phoneBook[1].UserData3);
- cout<<phoneBook[1].UserData0<<" Testing"<<endl;
- phoneBook[0] = UserData;
- phoneBook[1] = UserData;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement