•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C section within the Software Development category of DaniWeb, a massive community of 391,922 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,713 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C advertiser:
THE program highlights how to create a 2d array in freestore using pointers..
this is my first post so if i commit any fallacies regarding protocol or syntax please forgive me ....
this is my first post so if i commit any fallacies regarding protocol or syntax please forgive me ....
# include <iostream.h> void main() { int **a=new int*[10] ; cout<<"ENter the no of arrays : " ; int n ; cin>>n ; int i,p[5],x=0 ; ; for(i=0 ; i<n ; i++) { cout<<"ENter the no. of elements in the "<<i+1<<" array :" ; cin>>p[x] ; a[i]=new int[p[x]] ; for (int j=0 ; j<p[x] ; j++) { cout<<"enter : " ; cin >> a[i][j] ; } x++ ; } x=0 ; int j ; for (i=0 ; i<n ; i++) { for(j=0 ; j<p[x] ; j++) { cout<<a[i][j]<<" " ; } x++ ; } }
Post Comment
•
•
•
•
DaniWeb Marketplace (Sponsored Links)