Correct use of VOLATILE COST (and ROWS) indications in Postgresql stored procedure
VOLATILE is completely independent from COST.
The first defines function volatility and VOLATILE is the default, so it can be omitted. Alternatives are STABLE and IMMUTABLE.
The latter is only valid in combination with a COST parameter, like COST 500. The default is COST 100 which, again, can be omitted. It declares the cost per row of the result, which is used by the query planner to find the cheapest plan. If you don't know what you are doing exactly, just leave it at the default.
Read the very fine manual, starting at the chapter CREATE FUNCTION.