Paste
Copy
Cut
Options

¡Tu solución está lista!

Nuestra ayuda de expertos desglosó tu problema en una solución confiable y fácil de entender.

Mira la respuesta
  • Pregunta: static int x = 1; int y = x * 2; void t1() { y++; cout << "x: " << x << " | y: " << y << endl; y += 1; X-= -1; } void t2() { int* x = &y; cout << "x: " << x << " | y: " << y << endl; } void t3() { int y = x; static int x = 2; cout << "x: "< vec1 { 1, 3, 5, 7, 9 }; vector vec2{ 2, 4, 6, 8, 10 }; vec1.swap(vec2); int* ptr = &vec1[1]; y = *(ptr + 2); t1();

    student submitted image, transcription available below

    Muestra el texto de la transcripción de la imagen
  • Chegg Logo
    Esta es la mejor manera de resolver el problema.
    Solución

    Code: Output: t2() c

    Mira la respuesta completa
    answer image blur
Texto de la transcripción de la imagen:
static int x = 1; int y = x * 2; void t1() { y++; cout << "x: " << x << " | y: " << y << endl; y += 1; X-= -1; } void t2() { int* x = &y; cout << "x: " << x << " | y: " << y << endl; } void t3() { int y = x; static int x = 2; cout << "x: "<<x+1 << " | y: " << y + x << endl; x += y; } void t4() { 2. 3. 4. 5. int y = x + 1; int& z = y; z += -1; cout << "x: "<<x+z<< " | y: "<<y << endl; } int main() { vector<int> vec1 { 1, 3, 5, 7, 9 }; vector<int> vec2{ 2, 4, 6, 8, 10 }; vec1.swap(vec2); int* ptr = &vec1[1]; y = *(ptr + 2); t1(); t2(); t3(); t3(); t4(); return 0; This program outputs 5 lines. What are they? 1.