Click here to Skip to main content
15,918,267 members
Please Sign up or sign in to vote.
1.50/5 (2 votes)
See more:
Hi,
A) Create 2D array of size[4][3] Then insert values to the 1st column of the array from the keyboard and assign 0 for all the other elements.

B) Write a function called dispalyArray() to display the content.

void dispalyArray (int arr[][4], int rows, int columns);

Please help me..

What I have tried:

I do not know much about arrays. So trying to learn about arrays from the beginning.
Posted
Updated 14-Sep-16 2:54am
v2
Comments
phil.o 14-Sep-16 6:40am    
And what does your course say about arrays, especially 2D ones?

Because it looks like your homework I give you the link to tutorial about arrays.

And some additonal tips:
C++
int arr[4][3] = {0};//init a 2-dimensional array with size of 4 x 3 with value of 0
arr[1][0] = 3;//setting a value at position
int value = arr[1][0];//getting the value 


For output on the screen you can use the print command.

With that knowledge it really should be very easy.
 
Share this answer
 
Comments
Member 12739755 14-Sep-16 7:34am    
Thank u very much.. No its an exam question
We do not do your HomeWork.
HomeWork is not set to test your skills at begging other people to do your work, it is set to help your teacher to check your understanding of the courses you have taken and also the problems you have at applying them.
Any failure of you will help your teacher spot your weaknesses and set remedial actions.
So, start working. If you are stuck on a specific problem, show your code and explain this exact problem, we may help.

Here is links to references books on C and C++ by the authors of the languages. Note than C is the ancestor of C++, so knowing C is always useful with C++.
The C Programming Language - Wikipedia, the free encyclopedia[^]
https://hassanolity.files.wordpress.com/2013/11/the_c_programming_language_2.pdf[^]
http://www.ime.usp.br/~pf/Kernighan-Ritchie/C-Programming-Ebook.pdf[^]

C++ Programing Language[^]
 
Share this answer
 
Comments
Member 12739755 14-Sep-16 7:39am    
Thank you very much..I have done selection questions, functions questions and file handling questions last days by referring links which are related to C++..but i couldn't understand arrays :( . That's why I'm looking for help
Patrice T 14-Sep-16 10:23am    
The links are reference books, they are worth reading.
If you are really interested in C++ arrays, then have also a look at std::array[^] class.
 
Share this answer
 
Comments
Member 12739755 15-Sep-16 8:56am    
Thank you very much :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900