This extension provides a simple set of VSCode snippets for the C programming language. Can be found here on the Visual Studio Marketplace.
| Snippet Description | Snippet Input | Snippet Code | 
|---|---|---|
| Starter Template | sst | #include <stdio.h> | 
| Starter template with stlib.h | libsst | #include <stdio.h> | 
| Conditionals and loops | ||
| If statement | if | if (expression) { | 
| Else if statement | elif | elseif (expression) { | 
| Else statement | else | else { | 
| For loop | for | for (int i = 0; i < count; i++) { | 
| While loop | while | while (expression) { | 
| Do...while loop | dowhile | do { | 
| Header file include guard | ig | #ifndef {transformed_file_name}  | 
| Linked lists | ||
| Linked list template | clist | typedef struct _node * Link; | 
| Functions | ||
| Create int function | intfunc | int func_name () { | 
| Create float function | flfunc | float func_name () { | 
| Create string function | strfunc | char[] func_name () { | 
| Create long function | longfunc | long func_name () { | 
| Create definition for virtual table | vtdef | typedef struct {ClassName}{  | 
| Create function for virtual table | vtfunc | {ReturnType} (*{FunctionName})(struct {ClassName} *self) | 
| Print statements | ||
| Print variable of type float (2 decimal places) | pflo | printf("var_name :>> %.2f\n", var_name); | 
| Print variable of type int | pint | printf("var_name :>> %d\n", var_name); | 
| Print variable of type char | pcha | printf("var_name :>> %c\n", var_name); | 
| Print variable of type pointer | ppoint | printf("var_name :>> %p\n", (void *) var_name); | 
| Print variable of type size_t | psiz | printf("var_name :>> %zu\n", var_name); | 
| Memory Allocation | ||
| Allocate memory using calloc | cal | {type} ptr = ({type})calloc(, sizeof({type}));  | 
If you would like to support development of the extension donate Bitcoin here: 1BnrjF49owBx7UjMaJt5crZw5DegUYG3mb