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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:37:41+00:00 2026-06-01T04:37:41+00:00

char **s = &Is this valid?; Is obtaining the address at which the address

  • 0
char **s = &"Is this valid?";

Is obtaining the address at which the address of a string literal is stored allowed in C?
I know that the string literal is stored in the .rodata datasegment. However, obtaining the address of that address doesn’t make sense.

It should be noted that gcc compiles this and produces a working executable.

  • 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-01T04:37:43+00:00Added an answer on June 1, 2026 at 4:37 am

    Your example is not valid:

    char **s = &"Is this valid?";   // Not valid, wrong type
    

    This is valid:

    char (*s)[15] = &"Is this valid?";  // OK
    

    The type of "Is this valid?" is char[15]. The type of a pointer to an array 15 of char is char (*)[15]. So the type of &"Is this valid?" is char (*)[15].

    The type of a string literal is char[N+1] where N is the length of the string.

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

Sidebar

Related Questions

Given the following: StreamLogger& operator<<(const char* s) { elements.push_back(String(s)); return *this; } StreamLogger& operator<<(int
the RSS feed of annuncistar.it isn't valid because the & char is not allowed
Please consider this code: template<typename T> char (&f(T[1]))[1]; template<typename T> char (&f(...))[2]; int main()
I run this piece of code on Visual C++ 2010 char c[10]; cin.get(&c[0],5); cin.get(&c[2],4);
I've recently been learning Haskell, and I noticed that the String type (or [Char]
Hi I have this code below which is meant to check that the url
is this valid void *p = &X; /* some thing */ p += 12;
As of what I know about '&' operator, it returns the base address of
I want to replace char '&' if it's not followed by '#'. For example
i have a function defined as follows: void AddHeadCode(std::ofstream &ostream, size_t length){ ostream.write((char*)length, sizeof(length));

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.