<aside> <img src="/icons/home_green.svg" alt="/icons/home_green.svg" width="40px" />
</aside>
Format Specifiers in C: printf and scanf
#include <stdio.h>
int main() {
// Your code here
return 0;
}
// If statement
if (condition) {
// code
} else if (condition) {
// code
} else {
// code
}
// While loop
while (condition) {
// code
}
// For loop
for (int i = 0; i < n; i++) {
// code
}
int array[5] = {1, 2, 3, 4, 5};
int *ptr = &variable;
*ptr = 10; // Dereferencing
return_type function_name(parameters) {
// function body
return value;
}
int *ptr = malloc(size * sizeof(int));
free(ptr); // Always free allocated memory
FILE *file = fopen("filename", "mode");
fprintf(file, "text");
fclose(file);
Remember to: