Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. CarmelRob

    String manipulation in vc++

    Are these assumptions correct as far as dynamic strings are concerned? char* str3 = new char[5]; str3[3] = 'A'; //run-time heap memory str3[15] = 'A'; //run-time heap memory str3 = "Robert"; //Pointer now pointing to a string literal requiring static stack memory Thanks a lot for your help...
  2. CarmelRob

    String manipulation in vc++

    The type of a string literal is "array of the appropriate number of const characters," so "Bohr" is of type const char[5]." Stroustrup pg.90 Doesn't this imply a string literal is const char[]?
  3. CarmelRob

    String manipulation in vc++

    Thanks for the clarification. One last question: char chararraytest[] = "John"; In this example is a const char[] being converted to a char[]? Thanks
  4. CarmelRob

    String manipulation in vc++

    //char* to new char instantiation char* str = new char; char* str2 = new char[]; char* str3 = new char[5]; //char* to new char assignment str3[0] = 'z'; //character assignment str3 = "matt"; //string assignment str3 = "mattttttty"; //resizable It looks like char* to new gives you the best of...
  5. CarmelRob

    String manipulation in vc++

    The C++ Programming Language by Stroustrup on page 90 makes a passing reference to your question. Speaking of char* string literals: "It is... an error to try to modify a string literal through such a pointer." char* p = "Plato"; p[4] = 'e'; //error: assignment to const; result is undefined...

Part and Inventory Search

Back
Top