Arista Network Interview Experience

Result
Ongoing
Posted
2 Oct 2025
317 reads

Summary

I had an interview at Arista Network focusing on C++ pointer concepts, including debugging code and fixing logical errors to achieve a desired output. I successfully navigated both parts of the problem.

How it went

My interview at Arista Network began with a C++ debugging problem. The interviewer presented me with a code snippet involving pointers and asked me to predict its output and explain the reasoning. I correctly determined that the output would be 'Value: 10' and explained that the function receives a copy of the pointer, so reassigning p within the function does not affect the original ptr in main. Following this, I was challenged to modify the function to make the program print 'Value: 100'. I proposed dereferencing p and assigning the value of x to the memory location it pointed to, thereby altering the value of a in main to 100.

Questions asked (2)

  1. 01

    C++ Pointer Debugging - Output Prediction

    Data Structures & Algorithms · Medium

    What will be the output of the provided C++ code snippet and why?

    #include <iostream>
    using namespace std;
    

    void function(int *p) { int x = 100; p = &x; }

    int main() { int a = 10; int *ptr = &a; function(ptr); cout << "Value: " << *ptr << endl; return 0; }

  2. 02

    C++ Pointer Debugging - Correcting Function Logic

    Data Structures & Algorithms · Easy

    Given the previous C++ code snippet, how would you modify the function to make it print Value: 100 instead of Value: 10, by changing only the function body?

    Original function:

    void function(int *p) {
        int x = 100;
        p = &x;
    }
    

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at Arista Network recently?

Write up your rounds while you still remember the questions. It helps the next person more than you would think.

Share your experience
Discussion 0

Questions for the author, or how your own interview compared.

Join the discussion

Sign in with Google to comment or ask the author a question.

No comments yet

Be the first to share your thoughts and start the discussion!