Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main() {
- int *base = malloc(20);
- short c;
- for(c=0; c<20; c++) {
- base[c] = 0;
- }
- short values[6] = {94, 72, 103, 36, 38, 102};
- for(c=0;c<=(sizeof(values) /sizeof(short));c++) {
- // supports numbers under 1000
- short unitval = values[c] % 10;
- if (*(base + (unitval * 4) + 2)) {
- //memory address free
- *(base + (unitval * 4) + 2) = values[c];
- }
- else {
- //isn't free checks flag and then moves through
- if (*(short *)(base + (unitval * 4))) {
- //flag set (overwriting)
- *(short *)(base + (unitval * 4)) = values[c];
- }
- else {
- short c1;
- }
- }
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment