Skip to content

Instantly share code, notes, and snippets.

@iodiot
Created May 22, 2013 07:08
Show Gist options
  • Save iodiot/5625767 to your computer and use it in GitHub Desktop.
Save iodiot/5625767 to your computer and use it in GitHub Desktop.
// 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