It is suggested that the stellar initial mass function (IMF) is closely related to the geometrical structure of star-forming clouds, and that the power-law form of the upper IMF results from accretion processes in hierarchical groupings of forming stars. If the stars in these groupings form from linear cloud structures such as filaments or strings of clumps, and if the overall structure of star-forming clouds is sheet-like or two-dimensional, then the mass of the most massive star that can form in each grouping is predicted to increase as the square root of the group mass; this in turn implies an IMF with a slope of x = 2, in acceptable agreement with observations. More generally, if star-forming clouds have fractal structures, and if stars form with masses proportional to the linear dimensions of the basic cloud structures from which they form, as might be expected if these structures are isothermal filaments, then the predicted slope x of the IMF is equal to the cloud fractal dimension. which has been estimated by several studies to be about 2.3. The fragmentation of such filaments is also predicted to yield a minimum stellar mass of the order of 0.1 M(.).