Skip to content

MateenHussain391/cpp-pointer-array-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 

Repository files navigation

cpp-pointer-array-demo

This is a simple C++ program that demonstrates the use of classes, pointers, and dynamic memory allocation. The program allows the user to input and display the names of multiple persons using an array of object pointers.

πŸ“Œ Features

Create a Person class Take input for multiple persons Store objects dynamically using pointers Display stored data Demonstrates basic Object-Oriented Programming (OOP) concepts

🧠 Concepts Used

Classes and Objects Pointers Dynamic Memory Allocation (new) Arrays of Pointers Member Functions

▢️ How to Run

Save the file as main.cpp Compile the program: Bash g++ main.cpp -o program Run the program: Bash ./program

πŸ“· Sample Output

Enter the name of Person : Ali

Enter the name of Person : Ahmed

Enter the name of Person : Sara

Enter the name of Person : Zain

Enter the name of Person : Mateen

The name of the person is : Ali

The name of the person is : Ahmed

The name of the person is : Sara

The name of the person is : Zain

The name of the person is : Mateen

πŸ“š Author

Muhammad Mateen

About

πŸ”— C++ program using array of pointers to dynamically allocate Person objects on the heap.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors