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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:47:00+00:00 2026-05-26T14:47:00+00:00

const char *pointerStr[]= { BEST123, , // 0x00 Best2233, , // 0x01 ABCDEFGH, ,

  • 0
const char *pointerStr[]=
{
   "BEST123,      ",     // 0x00
   "Best2233,     ",     // 0x01
   "ABCDEFGH,     ",     // 0x02
   "123456,     ",     // 0x03
   "helloworld,     "     // 0x04
};
typedef struct
{
   char value;
   char name[40]; 
}StrInfo;

typedef struct
{
   int regMax;
   StrInfo info[60];   
} structNew;

void main()
{
  int i;
  structNew  pret;
for ( i=0;i<5;i++)
{     
  printf("PointerStr size of %dth %d \n",i,sizeof(pointerStr[i]));
  printf("pret size of %dth %d \n",i,sizeof(pret.info[i].name));
}
}

The above program produce the result of

PointerStr size of 0th 4 
pret size of 0th 40 
PointerStr size of 1th 4 
pret size of 1th 40 
PointerStr size of 2th 4 
pret size of 2th 40 
PointerStr size of 3th 4 
pret size of 3th 40 
PointerStr size of 4th 4 
pret size of 4th 40 

If I want to know the size of each and every string in PointerStr then how to find it? Is it possible only using strlen ? do we have some other way ? How this variable length array is stored in memory ?
The result is becoz that pointerStr is pointer variable and its size is always 4. Please correct me if I am wrong.

  • 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-26T14:47:00+00:00Added an answer on May 26, 2026 at 2:47 pm

    The length of a C string is implicit: it is determined by where the terminating '\0' is in the string, so you will need a function like strlen to determine the length of a string.

    The values ‘returned’ by sizeof are determined by the compiler by looking at the type of the data, instead of the data itself.

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

Sidebar

Related Questions

In code: struct Rep { const char* my_data_; Rep* my_left_; Rep* my_right_; Rep(const char*);
Considering this code fragment: struct My { operator const char*()const{ return my; } }
I want to hold a bunch of const char pointers into an std::set container
const char* title = old title; HWND hwnd = FindWindow(title, title); SetWindowText(hwnd, new title);
char *p=orkut vs const char *p=orkut whats the difference btwn these two... EDIT from
I have a const char arr[] parameter that I am trying to iterate over,
void CApplication::SendData( const char pBuffer[] ) { if( pBuffer == NULL ) { Log()->Write(
int KMP( const char *original, int o_len, const char *substring, int s_len ){ if(
Why does: const char example; (uint64*)example have a value of 140734799798420 and *(uint64*)example have
Consider this code: const char* someFun() { // ... some stuff return Some text!!

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.