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

  • SEARCH
  • Home
  • 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 6703189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:08:31+00:00 2026-05-26T07:08:31+00:00

I have 2 doubts regarding basics of pointers usage. With the following code int

  • 0

I have 2 doubts regarding basics of pointers usage.

With the following code

 int (*p_b)[10];
 p_b = new int[3][10];
 // ..do my stuff
 delete [] p_b

p_b is pointing to an array of 3 elements, each having fixed-size length of 10 int.

Q1:

How to declare p_b if I want that each element be a pointer to a fixed array size?
Basically I want the following

  p_b[0] = pointer to a fixed-array size of 10
  p_b[1] = pointer to a fixed-array size of 10
  // ... and so on

I was thinking to int (** p_b)[10] but then I don’t know how to use new to allocate it? I would like to avoid falling back to more general int** p_b

Q2:

Is per my original code sample above, how to call new so that p_b points to a unique fixed-size array of 10 int other than calling p_b = new int[1][10] ? To free memory I have to call delete[] while I cannot find an expression where I can call only simply delete.

  • 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-05-26T07:08:32+00:00Added an answer on May 26, 2026 at 7:08 am

    p_b is pointing to an array of 3 elements, each having fixed-size length of 10 int.

    How to declare p_b if I want that each element be a pointer to a fixed array size?

    Does your first sentence not completely cover that question?

    Is per my original code sample above, how to call new so that p_b points to a unique fixed-size array of 10 int other than calling p_b = new int[1][10]? To free memory I have to call delete[] while I cannot find an expression where I can call only simply delete.

    I completely do not understand why this is a problem, but you could do it by wrapping your array inside another type… say std::array, boost::array or std::vector.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: http://jsfiddle.net/fCWJ5/1/ , and following doubts regarding the viewbox. body{margin:0;}
i have a doubt regarding sizeof operator Code 1: int main() { int p[10];
I have some doubts regarding the following controller action (in ASP.NET MVC, but it's
I have some doubts regarding sitemap.xml generation and Django's sitemap framework particularly. Let's say
I have some doubts regarding In-Application-Billing in android: Can i test it with different
I have few doubts regarding transparent AlertDialog box in android.I have created the alert
I have few doubts regarding the 3d Animation Image View on android.i have created
I have couple of doubts regarding the process and threads and are given below
I am a newbie to Cocoa, I have a few doubts regarding NSImage. Question1:
am going through enterprise session bean material.i have doubts regarding below oints :- 1)

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.