Created
March 30, 2012 18:57
-
-
Save jussi-kalliokoski/2254033 to your computer and use it in GitHub Desktop.
Pointers in JavaScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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