Domanda di colloquio di Cisco

Write a program that copies a string to the next location in memory.

Risposta di colloquio

Anonimo

28 feb 2017

One potential solution is to use an array, since those are just blocks of contiguous memory. In C++: int main() { string str_arr[2] = {"hello"}; str_arr[1] = str_arr[0]; cout << str_arr[1]; } And the output should be "hello".