ring of integers
Inside the rational numbers, the “whole numbers” are exactly the integers Z. Inside a bigger number field, we want the analogous notion: the elements that are honest integers and not fractions. The right answer is to keep exactly those numbers of the field that are algebraic integers. This collection is a ring, and it is the foundation on which all arithmetic in the field is built.
Formally, for a number field K the ring of integers O_K is the integral closure of Z inside K: the set of elements of K that satisfy a monic polynomial with integer coefficients. It is a free Z-module of rank n = [K : Q], so it has an integral basis of n elements, and its fraction field is K. The ring O_K plays the structural role that Z plays for Q.
What makes O_K powerful is that it is a Dedekind domain: even when individual elements fail to factor uniquely, every nonzero ideal factors uniquely into prime ideals. So the loss of unique factorization of numbers is repaired one level up, at the level of ideals, and the discrepancy is measured by the ideal class group.
For the Gaussian field Q(i), the ring of integers is O_K = Z[i] = {a + bi : a, b in Z}, with integral basis {1, i}.
Z[i] is even a Euclidean domain, so here unique factorization of elements survives and the class number is 1.
Beware the naive guess O_K = Z[a] when K = Q(a). It often holds, but not always: for K = Q(sqrt(5)) the ring of integers is Z[(1 + sqrt(5))/2], strictly larger than Z[sqrt(5)]. Whether Z[a] equals O_K is governed by the index dividing the discriminant.