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 9005133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:04:04+00:00 2026-06-16T01:04:04+00:00

Does memory allocation for pointer is same in both scenarios struct_datatype * p=NULL; struct_datatype

  • 0

Does memory allocation for pointer is same in both scenarios

struct_datatype * p=NULL;

struct_datatype * p=malloc;

apart from memory allocation from stack and heap ??

  • 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-16T01:04:05+00:00Added an answer on June 16, 2026 at 1:04 am

    The question is not clear what you are asking about.

    struct_datatype * p=NULL;
    No memory has been assigned to p. It points to no allocated memory.

    struct_datatype * p=malloc();
    Some memory might have been allocated and the address of the memory allocated has been assigned to p. If malloc failed NULL would have been assigned to p.

    NOTE: sizeof p will be sizeof struct_datatype* for both the cases.

    NOTE: The pointer variable p will have been assigned memory in the stack which is sizeof struct_datatype* in both the cases during compile time. The address stored in pointer p might be pointing to any valid memory address accessible in user address space. In the NULL case no address is assigned( and NULL is not user accessible address) but when you do malloc(if successful) the address of the memory allocated will be assigned to the pointer p from the heap space else again it will be assigned to NULL.

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

Sidebar

Related Questions

I am getting confused with memory allocation basics between Stack vs Heap . As
I am implementing a stack that does not require memory allocation and can take
How does C#, or other languages for that matter, handle memory allocation (and memory
Does printf occupy memory in the stack? printf(Hello world); Does Hello world have a
Simple question: does the Java memory/synchronization model guarantee atomic pointer writes? That is, if
I have been struggling with pointer and memory allocation in c for a while.
I have an issue with a memory leak. I have a base-class pointer. From
I'm playing around with making an interpreter that does memory allocation in the style
I have an class A which uses a heap memory allocation for one of
Does the MEMORY storage engine of MySQL ever write to disk the database contents?

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.