The conformation and distribution of a flexible and semiflexible chain confined in an array of nanoposts arranged in parallel way in a square-lattice projection of their cross-section was investigated using coarse-grained molecular dynamics simulations. The geometry of the nanopost array was varied at the constant post diameter dp and the ensuing modifications of the chain conformation were compared with the structural behavior of the chain in the series of nanopost arrays with the constant post separation Sp as well as with the constant distance between two adjacent post walls (passage width) wp. The free energy arguments based on an approximation of the array of nanopost to a composite of quasi-channels of diameter dc and quasi-slits of height wp provide semiqualitative explanations for the observed structural behavior of both chains. At constant post separation and passage width, the occupation number displays a monotonic decrease with the increasing geometry ratio dc/wp or volume fraction of posts, while a maximum is observed at constant post diameter. The latter finding is attributed to a relaxed conformation of the chains at small dc/wp ratio, which results from a combination of wide interstitial volumes and wide passage apertures. This maximum is approximately positioned at the same dc/wp value for both flexible and semiflexible chains. The chain expansion from a single interstitial volume into more interstitial volumes also starts at the same value of dc/wp ratio for both chains. The dependence of the axial chain extension on the dc/wp ratio turns out to be controlled by the diameter of the interstitial space and by the number of monomers in the individual interstitial volumes. If these two factors act in the same way on the axial extension of chain fragments in interstitial volumes the monotonic increase of the axial chain extension with the dc/wp in the nanopost arrays is observed. At constant wp, however, these two factors act in opposite way and the axial chain extension plotted against the dc/wp ratio exhibits a maximum. In the case of constant post diameter, the characteristic hump in the single chain structure factor whose position correlates with the post separation is found only in the structure factor of the flexible chain confined in the nanopost array of certain value of Sp. The structure factor of the flexible chain contains more information on the monomer organization and mutual correlations than the structure factor of the semiflexible chain. The stiffer chain confined in the nanopost array is composed of low number of statistical segments important for the presence of respective hierarchical regimes in the structure factor.