datacamp-logo

First and last values of a vector

Consider these functions.

cppFunction('double fun1(NumericVector x) {
  return x[1];
}')

cppFunction('double fun2(NumericVector x) {
  int n = x.size();
  return x[n];
}')

Which statement is true?

Answer the question
50 XP
Possible Answers
  • press
  • press
  • press