learning-cc4e

Solution to https://cc4e.com/. If you copy these you're not right in the head.
git clone https://kaka.farm/~git/learning-cc4e
Log | Files | Refs

solution.c (325B)


      1 #include <stdio.h>
      2 
      3 int main()
      4 {
      5   char memory[256], token[256];
      6   int position = 0, value;
      7 
      8   while(scanf("%s", token) == 1 ) {
      9     if (token[0] == '>') {
     10       ++position;
     11     } else if (token[0] == '<') {
     12       --position;
     13     } else {
     14       memory[position] = atoi(token);
     15     }
     16   }
     17 
     18   printf("Memory:\n%s\n", memory);
     19 }