Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MyStruct const table[] =
- {
- { something1, otherthing1 },
- // ...
- };
- char c_arr[5][6][7];
- std::array<std::array<std::array<char, 7>, 6>, 5> cpp_arr;
- std::array<std::array<int, 3>, 3> arr1;
- char c_arr[3][3];
- //Create an array 3 x 5 (Notice the extra pair of braces)
- fsma::array_2d <double, 3, 5> my2darr = {{
- { 32.19, 47.29, 31.99, 19.11, 11.19},
- { 11.29, 22.49, 33.47, 17.29, 5.01 },
- { 41.97, 22.09, 9.76, 22.55, 6.22 }
- }};
- void foo(int bar) {
- double tempArray[bar];
- //Do something with the bar elements in tempArray.
- }
- void foo(int bar) {
- double* tempArray = new double[bar];
- //Do something with the bar elements behind tempArray.
- delete[] tempArray;
- }
- void smoothImage(int width, int height, int (*pixels)[width]) {
- int (*copy)[width] = malloc(height*sizeof(*copy));
- memcpy(copy, pixels, height*sizeof(*copy));
- for(y = height; y--; ) {
- for(x = width; x--; ) {
- pixels[y][x] = //compute smoothed value based on data around copy[y][x]
- }
- }
- free(copy);
- }
- void smoothImage(int width, int height, int* pixels) {
- int* copy = new int[height*width];
- memcpy(copy, pixels, height*width*sizeof(*copy));
- for(y = height; y--; ) {
- for(x = width; x--; ) {
- pixels[y*width + x] = //compute smoothed value based on data around copy[y*width + x]
- }
- }
- delete[] copy;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement