Perform the functionality of 2-D array through 1-D array
and in it the functions to be performed were:
(1) Display the array in 2-D format
(2) Display a particular element
(3) Display a particular row
(4) Display a particular column

Answer Posted / sandeep

#include<stdio.h>
#include<conio.h>
void main()
{
static int *arr[5],arr1[5],arr2[5],arr3[5],arr4[5],arr5[5];
int *temp;
clrscr();
arr[0]=arr1;
arr[1]=arr2;
arr[2]=arr3;
arr[3]=arr4;
arr[4]=arr5;

for(i=0;i<5;i++)
{
for(int j=0;j<5;j++)
printf("%d ",arr[i][j]);
printf("\n");
}
getch();

}

Is This Answer Correct ?    6 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Code for Small C++ Class to Transform Any Static Control into a Hyperlink Control?

2557


how to diplay a external image of output on winxp by using c & c++,

2930


Code for Method of Handling Factorials of Any Size?

2000


can you please write a program for deadlock that can detect deadlock and to prevent deadlock.

2737


write a program that reads a series of strings and prints only those strings begging with letter "b"

2668






write a program that reverses the input number of n.Formulate an equation to come up with the answer.

7030


write a program to calculate the amount of investment after a period n years if the principal investors was p and interest is calculated using compound interest,formular=a=p(1+r)^n

2364


develop a program to calculate and print body mass index for 200 employees

2208


Ask the user to input three positive integers M, N and q. Make the 2 dimensional array of integers with size MxN, where all the elements of I (I = 1,…,M) line will be members of geometrical progression with first element equal to the number of line (I) and denominator q.

3389


3. Program to find the Sum of give series. a. (1)+(1+2)+(1+2+3)+(1+2+3+4)+……………………………….. b. 1/1+1/9+1/25+1/49+……………...

4349


what mean void creat_object?in public class in this code class A{ public: int x; A(){ cout << endl<< "Constructor A";} ~A(){ cout << endl<< "Destructor A, x is\t"<< x;} }; void create_object(); void main() { A a; a.x=10; { A c; c.x=20; } create_object(); } void create_object() { A b; b.x=30; }

2061


how to take time as input in the format (12:02:13) from user so that controls remains between these columns?

1813


Implement a command console for changing settings on a particular object. The command console should allow you to enter a string and will return the response (very similar to a terminal session). The commands are as follows: SET propertyname=newvalue will change the target object’s member named “propertyname” to have a value equal to “newvalue”. If the input value is incompatible (i.e. an int being set to a string), print out an appropriate error message. GET propertyname will print out the current value of the target object’s member named “propertyname”. GET * will print out a list of all target object members and their current values. The system should be extensible for future commands and should accept an arbitrary object, such that another developer could insert another object into the system and rely on the command console to get and set the properties correctly.

3393


find level of following tree (state, parent) " J,D I,D H,C E,B F,B G,C B,A D,A C,A A,& K,E L,E L,F M,F N,G O,H P,I P,H Q,I R,J S,K U,P T,L

2002


how to write a program that opens a file and display in reverse order?

2561