Skip to content
This repository was archived by the owner on Feb 22, 2022. It is now read-only.

Latest commit

 

History

History
48 lines (35 loc) · 1.2 KB

01_Executable_Code.md

File metadata and controls

48 lines (35 loc) · 1.2 KB

LiaScript

Executable Code

This is an exemplary LiaScript document embedding executable code.

#include <stdio.h>
#include <stdlib.h>

#define ZIELWERT 18

int main(void)
{
  int a[] = {1, 2, 5, 7, 9, 10, 12, 13, 16, 17, 18, 21, 25};
  int *ptr_left = a;
  int *ptr_right = (int *)(&a + 1) - 1;
  printf("Value left %3d right %d\n-----------------------\n", *ptr_left, * ptr_right);
  do{
    printf("Value left %3d right %d", *ptr_left, * ptr_right);
    if (*ptr_right + *ptr_left == ZIELWERT){
       printf(" -> TREFFER");
    }
    printf("\n");
    if (*ptr_right + *ptr_left >= ZIELWERT) ptr_right--;
    else ptr_left++;
  }while (ptr_right != ptr_left);
  return EXIT_SUCCESS;
}

@LIA.eval(["main.c"], gcc -Wall main.c -o a.out, ./a.out)