Declaration part in C++

Started by sukishan, Jul 10, 2009, 09:57 PM

Previous topic - Next topic

sukishan

Declarations

A declaration creates a type, object, or function and gives it a name. The syntax is a type name followed by a list of objects with possible modifiers and initializers applying to each object. A name consists of upper or lowercase letters, digits, and underscores (_) with a leading letter. (Leading underscores are allowed but may be reserved). An initializer appends the form =x where x is an expression, or (x,y) for a list of one or more expressions. For instance,

  string s1, s2="xxx", s3("xxx"), s4(3,'x'), *p, a[5], next_Word();

declares s1 to be a string with initial value "", s2, s3, and s4 to be strings with initial value "xxx", p to be a pointer to string, a to be an array of 5 strings (a[0] to a[4] with initial values ""), and next_Word to be a function that takes no parameters and returns a string.
A good beginning makes a good ending