In the C/C++ editor, when you enter a letter combination in the editor, right-click and click Content Assist. A list of code elements and code templates that start with the letter combination that you typed is displayed.
Content assist provides code completion assistance while you code from within the body of a method or a function. For the current project and any referenced projects, a list is displayed of the elements that begin with the letter combination you entered in the order shown below:
You can view the signature of each item on the list in a pop-up by pointing to it. You can then select an item in the list to insert it directly into your code. Newly created elements in your current or referenced project(s) must be saved before they will appear in the Content Assist list.
Code templates are frequently used sections of code that you can create and then save for reuse. The Content Assist feature also provides access to code templates. Code Template names beginning with the letter combination you entered are displayed in a list in alphabetical order followed by code elements. You can then select a code template from the list and it is inserted directly into your code.
For example, the code template do - while statement contains the code:
do {
${cursor}
} while (${condition});
When you select the do code template from the list, the following is inserted in your code:
do {
} while (condition);
A selection of common code templates are already defined. These can be browsed in Window > Preferences > C/C++ > Code Templates.
You can create, import and, export code templates.
Using Content Assist
Creating and editing code templates
Importing and exporting code templates