Logo

Programming-Idioms

Declare and initialize a new list items, containing 3 elements a, b, c.
Implementation
C++

Implementation edit is for fixing errors and enhancing with metadata. Please do not replace the code below with a different implementation.

Instead of changing the code of the snippet, consider creating another C++ implementation.

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating material.

Please try to avoid dependencies to third-party libraries and frameworks.

Other implementations
items := []T{a, b, c}
items = [a, b, c]
auto items = [a, b, c];
let items = vec![a, b, c];
items = [a, b, c]
const items = [a, b, c];
const items = new Array(a, b, c);
items = {a, b, c}
import java.util.List;
import java.util.ArrayList;
List<T> items = new ArrayList<>();
items.add(a);
items.add(b);
items.add(c);
items = [a, b, c]
#include <vector>
std::vector<T> items = {a, b, c};
(define items (list a b c))
items = [a, b, c]
my @items = ($a, $b, $c);
uses classes;
var
  Items: TList;
  a,b,c: pointer;
begin
  Items := TList.Create;
  Items.Add(a);
  Items.Add(b);
  Items.Add(c);
end.
$items = [$a, $b, $c];
import java.util.List;
import java.util.Arrays;
List<T> items = Arrays.asList(a, b, c);
val items = List(a, b, c)
(defparameter *items* (list a b c))
using System.Collections.Generic;
var items = new List<T>{a,b,c};
(def items (list a b c))
integer, dimension(3) :: items
items = [a,b,c]
Items = [A,B,C].
Dim salmons As New List(Of String) From
    {"chinook", "coho", "pink", "sockeye"}
val items = listOf(a, b, c)
var items = [a, b, c];
NSArray *items=@[a,b,c];
import java.util.List;
var items = List.of(a, b, c);
def items = [a, b, c]
items := {a . b . c}.
T[] items = new T[] { a, b, c };