answersLogoWhite

0


Best Answer

Wright a 'C' program for storage representation of 2-D array.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: C program for storage representation of 2-D array?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Can you give an example of array program?

int main (int argc, char *argv[]) { int i; for (i=0; i<argc; ++i) printf ("%2d: %s\n", i, argv[i]); return 0; }


Subtraction of 2d array in java?

looda le lo mera


How to write C multiplication table?

/****************************************** * C Program to print MultiplicationTable * * Author of the Program: M.JAYAKUMAR..* * Date 23 Nov 2006 * * ***************************************/ #include<stdio.h> main() { int i, p=1, table[10]; /* define integres and array */ /* *************************** * Output Formating Begins * ***************************/ for(i=0;i<61;i++) printf("#"); printf("\n# Program to print Multiplication table of any number"); printf("\n# NOTE: To exit type 0 \n"); for(i=0;i<61;i++) printf("#"); /* *************************** * Output Formating ENDS * ***************************/ while(p != 0) { printf("\nWhich table "); scanf("%d",&p); /* takes input from input */ for(i=0;i<10;i++) /* Fills the array */ { if(p==0) /* Stratagy to exit the program Benins */ { printf("Exiting\n"); break; } /* Stratagy to exit the program ends */ table[i]=i+1; /* Fills the array with numbers 1 - 10 */ printf("%2d x %2d = %2d\n", p, table[i], p * table[i]); } } }


What is a program to sort a two dimensional integer array?

Any multi-dimensional array can be flattened into a linear array. For instance,[[1,2,3],[4,5,6],[7,8,9]]can be flattened into[1,2,3,4,5,6,7,8,9].So a solution to your problem (certainly not the most efficient) would be to flatten the 2d array into a linear array, and sort using a traditional sorting algorithm or Arrays.sort. You would then insert the sorted elements back into the 2d array. This would have nlog(n) complexity.An implementation below:public static void sort2d(int[][] arr){int r = arr.length;int c = arr[0].length;int[] flat = new int[r*c];for (int i = 0; i < r; i++)for (int j = 0; j < c; j++)flat[i*c+j] = arr[i][j];Arrays.sort(flat);for (int i = 0; i < flat.length; i++)arr[i/r][i%c] = flat[i];}


C program for 2D convolution?

You can use ImageMagick library and use 'convolve' function.

Related questions

Difference between 1D array and 2D arrays?

1d array contains single row and multiple columns and 2d array contains multiple row and multiple columns. 2d array is a collection of 1d array placed one below another,while 1d array is simple a collection of elements.


Flow chart of multiplication of 2d array?

algorithm &amp; flowchrt of 2d matrices


Is there any overhead issues if you make a 2D array arr28 rather than making a 1D array arr16 of size 16 Any memory issues or execution differences between the two?

2D array of size 2x8 and 1D array of size 16


What is the relationship between 2D shapes of a net and a 3D solid?

A net is a 2D representation of a 3D shape


Can you give an example of array program?

int main (int argc, char *argv[]) { int i; for (i=0; i&lt;argc; ++i) printf ("%2d: %s\n", i, argv[i]); return 0; }


Subtraction of 2d array in java?

looda le lo mera


How to write C multiplication table?

/****************************************** * C Program to print MultiplicationTable * * Author of the Program: M.JAYAKUMAR..* * Date 23 Nov 2006 * * ***************************************/ #include&lt;stdio.h&gt; main() { int i, p=1, table[10]; /* define integres and array */ /* *************************** * Output Formating Begins * ***************************/ for(i=0;i&lt;61;i++) printf("#"); printf("\n# Program to print Multiplication table of any number"); printf("\n# NOTE: To exit type 0 \n"); for(i=0;i&lt;61;i++) printf("#"); /* *************************** * Output Formating ENDS * ***************************/ while(p != 0) { printf("\nWhich table "); scanf("%d",&amp;p); /* takes input from input */ for(i=0;i&lt;10;i++) /* Fills the array */ { if(p==0) /* Stratagy to exit the program Benins */ { printf("Exiting\n"); break; } /* Stratagy to exit the program ends */ table[i]=i+1; /* Fills the array with numbers 1 - 10 */ printf("%2d x %2d = %2d\n", p, table[i], p * table[i]); } } }


As per 2D representation what is the name of earth's surface or aprt of it on a flat surface?

Map


How do you pass a 2D array in a functions?

if you were to call a function you would write it as: function(array[][], int pretend, double pretend2); arrays will always be passed by reference, not by value.


How do you access 2D array elements by using single variable?

int main() { int array[3][3]; int i; for(i=0; i &lt;9;i++) { printf("the element is %d\n", array[i/3][i%3]); } return 0; }


What is the name of a 2d square based pyramid?

A 2D representation of a square-based pyramid is called a square pyramid net or a square pyramid template.


Can you write a C program to find the sum of a given column in a 2D array?

Use the following function to find the sum of a given column in an array of integers: int sum_column (int** array, unsigned int rows, unsigned int columns, unsigned int column) { assert (column&lt;columns); int accumulator int row; accumulator = 0; for (row=0; row&lt;rows; ++row) { accumulator += array[row][column]; } return accumulator; }