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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:20:09+00:00 2026-05-28T15:20:09+00:00

I would like to count how many bytes a char pointer takes in memory.

  • 0

I would like to count how many bytes a char pointer takes in memory.
The pointer points to a string with 100 chars.

According to the following program a char needs 4 bytes

#include <stdio.h>
#include <stdlib.h>

int main(void)
{
  char b;
  b = 'b';
  printf("%p\n",&b);

  system("pause");
  return 0;
}

Is it the same for pointers?
So it’s 400 bytes saved in memory for a string of 100 chars?

  • 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-28T15:20:10+00:00Added an answer on May 28, 2026 at 3:20 pm

    char needs one byte. Pointer to anything usually needs 4 or 8 bytes depending on the architecture. Of course an object and a pointer to it are separate things and they use separate memory, so if a 100-char string uses 100 or 101 byte (depends on how do you count and how do you store the string), a pointer to it will still use 4 bytes.

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

Sidebar

Related Questions

Given a cell with string values I would like to count how many different
For example, I would like to count how many numbers are in a string
I would like to create a string that uses a plural if count >
I would like a single query to count how many different customer accounts use
I would like to count how many automatic line breaks (not returns the user
I would like to be able to count how many times a function is
I would like to create a query that would count how many records were
I would like to count how many rows there is of the same order_id
I would like to get a count of how many times a substring occurs
I would like to count the number of installations of each Member in a

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.