Skip to content

Instantly share code, notes, and snippets.

@jussi-kalliokoski
Created March 30, 2012 18:57
Show Gist options
  • Save jussi-kalliokoski/2254033 to your computer and use it in GitHub Desktop.
Save jussi-kalliokoski/2254033 to your computer and use it in GitHub Desktop.
Pointers in JavaScript
#include <stdlib.h>
#include <stdio.h>
int main () {
char *c = (char *)malloc(sizeof(char) * 16);
char *cc = c;
for (int i=0; i<16; i++) {
printf("%d\n", cc[0]);
cc++;
}
return 0;
}
var c = new Uint8Array(16);
var cc = c;
for (var i=0; i<16; i++) {
print(cc[0]);
cc = cc.subarray(1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment