Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdlib.h>
- int main(int argc, char **argv) {
- // waste
- int *foo = (int*)malloc(sizeof(int)*10);
- int *bar = (int*)malloc(sizeof(int)*10);
- int *baz;
- // write past end of array
- bar[12] = 0;
- bar[0] = 0;
- if (baz)
- std::cout << "toto" << std::endl;
- // uninitialized pointer
- std::cout << *baz << std::endl;
- std::cout << *bar << std::endl;
- free(bar);
- std::cout << "Hello, world!" << std::endl;
- return 0;
- }
Add Comment
Please, Sign In to add comment