C Programming Manual Tracing Compiler:

C Programming Manual Tracing Compiler

C Programming Manual Tracing Github
Codecast France Profile

1. 1D Array

#include <stdio.h>
int main() {
    //! showArray(a, cursors=[i,n], n=8, cw=32)
    int i, n = 12;
    int a[n];
    a[0] = 1;
    for (i = 1; i < n; i++) {
        a[i] = a[i - 1] * 2;
    }
    for (i = 0; i < n; i++) {
        printf("a[%i] = %i\n", i, a[i]);
    }
}

2. 2D array global, initialized

#include <stdio.h>
int a[][2] = {{1, 2}, {3, 4}};
int main() {
    printf("%d %d\n", a[0][0], a[0][1]);
    printf("%d %d\n", a[1][0], a[1][1]);
    printf("%d %d %d %d\n", **a, *(*a + 1), **(a + 1), *(*(a + 1) + 1));
}

3. Composite type

#include <stdio.h>
int main() {

    // array of pointer to int
    int *a[1];
    int a_value = 1;
    a[0] = &a_value;

    // declare b as pointer to array of int
    int (*b)[];
    int b_value[1];
    b = &b_value;

    // declare foo as array 3 of array 2 of pointer to pointer to function returning pointer to array of pointer to char
    char *(*(**foo[3][2])())[];

    return 0;
}

4. Control Statement structures

#include <stdio.h>
int main() {
  int k;
  if (1) {
    printf("t");
  }
  if (0) {
    printf("F");
  } else {
    printf("!f");
  }
  for (k = 0; k < 3; k++) {
    printf("%i", k);
  }
  while (k < 5) {
    printf("%i", k);
    ++k;
  }
  do {
    printf("%i", k);
    k += 1;
  } while (k < 7);
}

5. Dynamic Memory Allocation (malloc)

#include <stdlib.h>
int main() {
    //! showMemory(start=272)
    int * p = malloc(4 * sizeof(int));
    int * q = malloc(1 * sizeof(int));
    free(q);
    int * r = malloc(2 * sizeof(int));
    return 0;
}