Created
August 3, 2011 21:14
-
-
Save kybernetyk/1123790 to your computer and use it in GitHub Desktop.
pointer moisms
This file contains 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 <stdio.h> | |
int main(int argc, char **argv) | |
{ | |
//lul, wie ich auf sowas reingefallen bin: ich erwartete dass | |
//der ptr um (2*4) byte inkrementiert wird. aber nein, dies | |
//war ein moismus. denn der pointer wird um (2*4)*sizeof(float) | |
//inkrementiert. | |
//*lach* keine skriptsprachen mehr fuer mich ... und keine | |
//typed pointer mehr. nur noch void und char! | |
float *ptr = 0; | |
printf("1. ptr: %p\n", ptr); | |
size_t sze = 4; | |
ptr += 2 * sze; | |
printf("2. ptr: %p\n", ptr); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment