It depends what you have in the cup: A cup is a measure of volume, but a gram is a measure of mass.
Depending on the density of the material you are going to have in the cup, the weight in grams of the material will vary. For example, if you fill the cup with lead, the cup will weigh much more than if you fill with feathers.
This question would be similar to asking how much a 6-foot person weighs. It depends on the person, of course. A cup of water will weigh more than a cup of flour.
For cooking, you can find tables that convert cups to grams and vice versa for a variety of food. Below is a link with a table for standard cooking ingredients. Make sure you look carefully and scroll down to find the correct conversion table specific ingredient you are using! The conversion is different for each ingredient!
Here are a few common foods and their conversion from cups to grams (notice how much the weight varies!):
Granulated sugar: 1 cup = 200 grams
Brown sugar: 1 cup, packed = 220 grams
Sifted white flour: 1 cup = 125 grams
White rice, uncooked: 1 cup = 185 grams
White rice, cooked: 1 cup = 175 grams
Butter: 1 cup = 227 grams
Almonds, slivered: 1 cup = 108 grams
Oil: 1 cup = 224 grams
Maple syrup: 1 cup = 322 grams
Milk, non-fat: 1 cup = 245 grams
Milk, sweetened condensed: 306 grams
Broccoli, flowerets: 1 cup = 71 grams
Raisins: 1 cup, packed = 165 grams
Milk, dry: 1 cup = 68 grams
Yogurt: 1 cup = 245 grams
Water: 1 cup = 236 grams
Confectioners sugar: 1 C = 110 g
Cocoa: 1 C = 125 g
To do the conversions, see the Related Link. Just enter the food and the amount, and it will convert any units you want!
There is also an IPhone App called Kitchen Calculator PRO which does weight to volume conversions and other useful stuff. Great cooking aid.
In that we're in a discussion of volume - cups and fluid ounces, you've asked a difficult question: If you're measuring water, then 1 ounce is equal
to 29.57353 ml, so 40 oz would be 1.183 liters. Since water weighs 1 gram per ml (or 1 kg per liter), then you'll have 1.183 kg, or 1,183 grams.
If, on the other hand, you are measuring anything else - oil, milk, flour, etc. - then you need to have one more piece of information before you can switch from volume to weight. You must know the specific gravity of the substance. An ounce of oil, for example, weighs less than an ounce of water (that's why oil floats on water).
Okay, one cup equals 236 cubic centimeters. However, a cup of milk will weigh a different number of grams than a cup of cod liver oil. But to cut to the quick, asking how many grams in a cup is like asking how many pounds in a gallon. You are using two entirely different types of measurement, one of weight, the other of volume, to ask the question. A given volume of space filled with two different types of materials will have two different weights. Also, remember that in the more logical English system of measurement, a fluid ounce and a dry ounce mean two different things.
1 cup = 240 ml = 8 fl oz = 1/2 pint (liq) = 16 tbsp = 48 tsp, all measurements regarding kitchen and cooking are standard and do not vary depending on the material.
It's true that it depends on the density of the ingredient you are measuring. Luckily, the nutrition label for many foods has a serving size listed in both volume and weight, which you can use for conversion.
For example, I have a recipe that calls for 250 grams of almond meal. The label on the almond meal says 1 serving = 1/4 cup (28 grams). So now I know that 1 cup = 112 grams (or 28 x 4). 250/112 = 2.23 cups, so that's how much almond meal I will use in my recipe.
A cup is a measure of liquid volume, equivalent to approximately 250 cubic centimeters. (cc's) One cubic centimeter of water weighs one gram at one degree Celsius. One cubic centimeter of gasoline weighs somewhat less, and one cubic centimeter of lead weights considerably more. So a cup of water would weigh about 250 grams, but a cup of gasoline would weigh less, and a cup of lead would weigh more.