Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8592633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:47:50+00:00 2026-06-11T23:47:50+00:00

int *ptr_Array; ptr_Array = new int[5]; Is it possible to remove the last element

  • 0
int *ptr_Array;
ptr_Array = new int[5];

Is it possible to remove the last element in the array?
I can PUSH the ints on one at a time.
I can delete the whole array.

delete []ptr_Array;
ptr_Array = NULL;

I can’t find a way to POP the elements off.

I tried the following and loads of other attempts.

ptr_Array[i_IastItem] = NULL; 

I just can’t figure it out, I have been trying all day.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T23:47:52+00:00Added an answer on June 11, 2026 at 11:47 pm

    You can by using a std::vector instead.

    std::vector<int> x;
    x.push_back(42);
    x.pop_back();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Convert a long hex string in to int array with sscanf I
Possible Duplicate: Declaring a C function to return an array I am new to
for( int i = 0; i < lines; i++ ) { std::unique_ptr<BYTE[]> pLine( new
// dll #include <memory> __declspec(dllexport) std::auto_ptr<int> get(); __declspec(dllexport) std::auto_ptr<int> get() { return std::auto_ptr<int>(new int());
How do smart pointers handle arrays? For example, void function() { std::unique_ptr<int> my_array(new int[5]);
There is an array lut_addresses[] of type int. There are some calculations for a
Consider the following simple code. struct test { test(int n):numelements(n){ arr = new int[numelements]
I am trying to declare a dynamic int array like below: int n; int
Using .NET 4.0 I can quickly convert a struct to and from an array
The topic generically says it all. Basically in a situation like this: boost::scoped_array<int> p(new

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.