Close Packed Structures of Solids
In the process of the formation of a crystal the constituent particles get packed quite closely. The crystal structures of the solids can be described in terms of a close packing of identical spheres. These are held together by forces of attraction.
Two Dimensional Structure
A linear horizontal arrangement of identical spheres in one dimension forms a row. A two dimensional close packed structure can be obtained by arranging a number of such rows to form a layer.

Square Close Packing
The arrangement in which each sphere is in contact with four other spheres is called square close packing.
Hexagonal Close Packing
The arrangement in which each sphere is in contact with six other spheres is called hexagonal close packing. In such a packing, the spheres of the third row are aligned with the first row. In the hexagonal close packed the spheres are more effectively packed.

In a hexagonal close packed layer there are some unoccupied spaces or voids. These are triangular in shape and are called trigonal voids. There are two types of triangular voids, one with the apex pointing upwards (X) and the other with the apex pointing downwards (Y).
Three Dimensional Structure
A three dimensional structure can be generated by placing two dimensional layers on top of each other. There are two possibilities. In one, you can place the second layer in such a way that the spheres of the second layer come exactly on top of the first layer. In other, the spheres of the second layer are in such a way that these are on the depressions of the first layer.
The first possibility is similar to square close packing and is accompanied by wastage of space. In the second possibility, the spheres of the second layer can occupy either the X or Y type trigonal voids but not both.
In this process, the sphere of second layer covers the trigonal voids of the first layer. It results into voids with four spheres around it. Such a void is called a tetrahedral void since the four spheres surrounding it are arranged on the corners of a regular tetrahedron.
In another possibility, the trigonal voids of the first layer have another trigonal void of the opposite type from the second layer over it. This generates a void which is surrounded by six spheres. Such a void is called an octahedral void because the six spheres surrounding the void lie at the corners of a regular octahedron.
Now when you place the third layer over the second layer, again there are two possibilities i.e., either the tetrahedral or the octahedral voids of the second layer are occupied.
If the tetrahedral voids of the second layer are occupied then the spheres in the third layer would be exactly on top of the first layer. The next layer (4th layer) which is then placed would align with the second layer. Every alternate layer will be vertically aligned. This is called AB AB … pattern.

If the octahedral voids of the second layer are occupied, the third layer is different from both the first as well as the second layer. In this case the next layer (the fourth layer) will be aligned with the first layer. This is called ABC ABC … pattern.

In three dimensional set up the AB AB … pattern is called hexagonal closed packing (hcp) while the ABC ABC … pattern is called cubic closed packing (ccp).
In general there is one octahedral and two tetrahedral voids per atom in the close packed structure. These voids are also called as interstices.
In the close packed structures (hcp and ccp) each sphere is in contact with six spheres in its own layer and is in contact with three spheres each of the layer immediately above and immediately below it. Each sphere is in contact with a total of twelve spheres. This number of nearest neighbor is called its coordination number.