In scientific literature, the term "carbohydrate" has many synonyms, like "sugar" (in the broad sense), "saccharide", "ose", "glucide", "hydrate of carbon" or "polyhydroxy compounds with aldehyde or ketone". Some of these terms, especially "carbohydrate" and "sugar", are also used with other meanings.
In food science and in many informal contexts, the term "carbohydrate" often means any food that is particularly rich in the complex carbohydrate starch (such as cereals, bread and pasta) or simple carbohydrates, such as sugar (found in candy, jams, and desserts).  This informality is sometimes confusing since it confounds chemical structure and digestibility in humans.
Often in lists of nutritional information, such as the USDA National Nutrient Database, the term "carbohydrate" (or "carbohydrate by difference") is used for everything other than water, protein, fat, ash, and ethanol. This includes chemical compounds such as acetic or lactic acid, which are not normally considered carbohydrates. It also includes dietary fiber which is a carbohydrate but which does not contribute  food energy in humans, even though it is often included in the calculation of total food energy just as though it did (i.e., as if it were a digestible and absorbable carbohydrate such as a sugar).
In the strict sense, "sugar" is applied for sweet, soluble carbohydrates, many of which are used in human food.