Calculations of lattice constant of 4H-SiC and diamond have been carried out. Lattice constant of 4H-SiC trends to decrease when nitrogen concentration increases. On the other hand, lattice constant of 4H-SiC trends to increase when aluminum concentration increases. Lattice constant of boron and phosphorus doped diamond trends to increase when impurity concentration increases. The effect of phosphorus on diamond lattice constant is about six times larger than that of boron.