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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:56:00+00:00 2026-05-26T07:56:00+00:00

string line = blerdy blah; for (int i = 0; i < string.size(); i++)

  • 0
string line = "blerdy blah";
for (int i = 0; i < string.size(); i++)
{

    line[i] != "n";
}

With this I get the error “cannot convert from char to const char *”

If I replace the last line with

line[i] != *"n";

It works. I get why in one sense, I’m dereferencing a pointer. What I don’t get is why it’s a pointer in the first place. Is any char written like this actually a pointer to one char somewhere? Like the program has one set of every symbol somewhere and this is what I’m pointing to?

If this is the case, can I do silly things like make the ‘n’ pointer point to something else?

  • 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-26T07:56:01+00:00Added an answer on May 26, 2026 at 7:56 am

    You have to compare char with char in this case:

    line[i] != 'n';
    

    When you say *"n" you actually dereference the first element of the char array with n and \0 elements inside it, which gives you n, that’s why it works, but you don’t want to write it like that.

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

Sidebar

Related Questions

At the following first line of code I get this error: cannot convert ‘std::string’
int main() { string line; char buff[10]; for(int i=0; i<10;i++) { cin.get(buff[i]); cout.put(buff[i]); if(i==10)
int Socket::Connect(const std::string& host, int port) { if(this->_connected) throw Socket is already connected; //
I have been following this convention thus far: std::string line; while(std::getline(in,line)) { if(line.size() &&
While trying this code,it shows this error in the string line. <% String error
I am getting an error when I run this piece of code string line;
This doesnt work: string fileContent = Resource.text; StreamReader read = File.OpenText(fileContent); string line; char[]
I am trying to parse a multi line string and get the rest of
I recently used the <<- operator to output a multi-line string, like this: <<-form
foreach (string line in textBox3.Lines) { int pos = line.IndexOf(?v=); string videoid = line.Substring(pos

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.