Question from the Language C - Fundamentals test

Write a C function to swap two integers.

Easy

What is the output of the following C code?

#include <stdio.h>

void swap(int *a, int *b) {
  int temp = *a;
  *a = *b;
  *b = temp;
}

int main() {
  int x = 5;
  int y = 10;
  swap(&x, &y);
  printf("x: %d, y: %d\n", x, y);
  return 0;
}
Author: Vincent CotroStatus: PublishedQuestion passed 266 times
Edit
1
Community EvaluationsNo one has reviewed this question yet, be the first!