Jump to content

  • Log In with Google      Sign In   
  • Create Account

14 years ago on June 15th Gamedev.net was first launched! We want to thank all of you for being part of our community and hope the best years are ahead of us. Happy birthday Gamedev.net!

#Actualmarkrodgers11

Posted 07 October 2012 - 12:03 AM

I am currently reading a book called "Accelerated C++ Practical Programming by Example" by Andrew Koenig and Barbara E. Moo and am confused on the difference between a string and a string literal.

Here is the excerpt from what I read:

The second new idea is that we can use + to concatenate a string and a string literal--or, for that matter, two strings (but not two string literals).


#4markrodgers11

Posted 06 October 2012 - 11:58 PM

I am currently reading a book called "Accelerated C++ Practical Programming by Example" by Andrew Koenig and Barbara E. Moo and am confused on the difference between a string and a string literal.

Here is the excerpt from what I read:

The second new idea is that we can use + to concatenate a string and a string literal--or, for that matter, two strings (but not two string literals).


EDIT:
I am thinking concatenating two strings would be like:

string test = firstName + lastName;

and two string literals would be like:

string literals = "i am a " + "string literal"

not sure if I am right, but I figure its better to find the answer other than guess and found out later you're wrong. Posted Image

#3markrodgers11

Posted 06 October 2012 - 11:58 PM

I am currently reading a book called "Accelerated C++ Practical Programming by Example" by Andrew Koenig and Barbara E. Moo and am confused on the difference between a string and a string literal.

Here is the excerpt from what I read:

The second new idea is that we can use + to concatenate a string and a string literal--or, for that matter, two strings (but not two string literals).


EDIT:
I am thinking a concatenating a two strings would be like:

string test = firstName + lastName;

and two string literals would be like:

string literals = "i am a " + "string literal"

not sure if I am right, but I figure its better to find the answer other than guess and found out later you're wrong. Posted Image

#2markrodgers11

Posted 06 October 2012 - 11:58 PM

I am currently reading a book called "Accelerated C++ Practical Programming by Example" by Andrew Koenig and Barbara E. Moo and am confused on the difference between a string and a string literal.

Here is the excerpt from what I read:

The second new idea is that we can use + to concatenate a string and a string literal--or, for that matter, two strings (but not two string literals).


I am thinking a concatenating a two strings would be like:

string test = firstName + lastName;

and two string literals would be like:

string literals = "i am a " + "string literal"

not sure if I am right, but I figure its better to find the answer other than guess and found out later you're wrong. :P

#1markrodgers11

Posted 06 October 2012 - 11:47 PM

I am currently reading a book called "Accelerated C++ Practical Programming by Example" by Andrew Koenig and Barbara E. Moo and am confused on the difference between a string and a string literal.

Here is the excerpt from what I read:

The second new idea is that we can use + to concatenate a string and a string literal--or, for that matter, two strings (but not two string literals).


PARTNERS