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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:44:06+00:00 2026-06-01T19:44:06+00:00

I Want to know why the first statements works and why not second one

  • 0

I Want to know why the first statements works and why not second one in c++

char a[10]="iqbal";  // it works

a="iqbal"; // does not work 
  • 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-01T19:44:08+00:00Added an answer on June 1, 2026 at 7:44 pm

    Strictly speaking, an array is not a pointer! And an array ( base address of the array ) cant be a modifiable lvalue. ie it cannot appear on the left hand side of an assignment operator.Arrays decay into pointers only in certain circumstances. Read this SO post to learn when arrays decay into pointers. Here is one more nice article which explains the differences between arrays and pointers

    Also read about lvalues and rvalues here so that you get an idea of things which cannot appear on the LHS of =

    char a[10]=”iqbal”;  // it works

    In this case, internally what happens is

    a[0] = 'i';
    a[1] = 'q'; 
     .
     .
    a[5] = '\0';
    

    So everything is fine as array[i] is a modifiable lvalue.

    a=”iqbal”; // does not work

    Internally, this is roughly equivalent to

    0x60000(Address of a, but is a simple number here ) = Address of "iqbal"
    

    This is wrong as we cannot assign something to a number.

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

Sidebar

Related Questions

First i briefly want to know how you can use oauth works. What we
First, I know about Clog , and I do not want to implement this
I have a problem but first i want to know if im working on
This is my first app with CI and I want to know whether $_POST
I want to know the difference between : $this->forward(module, action); And $this->redirect(module/action); My first
In our application, we receive messages from JMS Topic. First I want to know
First of all I don't know if this is the right approach. I want
First let me say I'm fully aware sql server does not short circuit evaluate.
i want know if is possible, to get a specific element value of a
I'm making a chat responder for a game and i want know if there

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.