Computer Science Projects

Pages

  • Home
  • News
  • Projects
  • Source Codes
  • Electronic Circuits
  • Download Softwares
  • Engineering Books

Dynamic 2d Array In C++




#include <iostream>
using namespace std;

int main() {

int row,col;
int **ptr;

cout<<"enter Rows : ";
cin>>row;
cout<<"enter Cols : ";
cin>>col;
ptr= new int*[row];

for (int i=0;i<row;i++)  // 2d array dynamically
 {
  ptr[i]= new int[col];
 }

for (int i=0;i<row;i++)  // delete 2d array
 {
 delete [] ptr[i];
 }
delete [] ptr;

system("pause");
return 0;
}
Posted by Unknown

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

Blog Archive

  • ▼  2014 (18)
    • ▼  January (18)
      • Mips Assembly Language Programming Tutorial pdf Do...
      • PHP 5 Power Programming pdf Free Download
      • A Complete Guide to Programming In C++ pdf Free Do...
      • C How To Program By Deitel and Deitel 6th Edition ...
      • Computer Organization And Design 4th Edition pdf F...
      • Object Oriented Programming In C++ By Robert Lafor...
      • Fundamentals Of Digital Logic With Verilog Design ...
      • Digital Logic And Microprocessor Design With VHDL ...
      • Practical C++ Programming 3rd Edition pdf Free Dow...
      • Fundamentals Of Digital Logic With VHDL Design 3rd...
      • Switch Statement In C++
      • If Else Statement In C++
      • While Loop In C++
      • For Loop In C++
      • Linked List In C++ Using Class
      • Dynamic 2d Array In C++
      • Dynamic Array In C++
      • Student Management System Project In C++
Simple theme. Powered by Blogger.