Created
May 22, 2013 07:08
-
-
Save iodiot/5625767 to your computer and use it in GitHub Desktop.
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
// fuck.cpp : Defines the entry point for the console application. | |
// | |
#include "stdafx.h" | |
#include <iostream> | |
using namespace std; | |
int main() | |
{ | |
const int x = 10; | |
const int y = 10; | |
int **a; | |
// create array | |
a = new int*[x]; | |
for (int i = 0; i < y; ++i) | |
a[i] = new int[y]; | |
// fill array | |
for (int i = 0; i < x; ++i) | |
for (int j = 0; j < y; ++j) | |
a[i][j] = i * j; | |
// test array | |
char s[0xff]; | |
sprintf(s, "a[0][0] = %d\na[5][5] = %d\n", a[0][0], a[5][5]); | |
cout << s; | |
// free array | |
for (int i = 0; i < y; ++i) | |
delete[] a[i]; | |
delete[] a; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment