Click here to Skip to main content
13,793,266 members

C / C++ / MFC

 
GeneralRe: How can I initialize an array of structs where the array size is set at compile time? Pin
arnold_w6-Apr-18 1:31
memberarnold_w6-Apr-18 1:31 
GeneralRe: How can I initialize an array of structs where the array size is set at compile time? Pin
Jochen Arndt6-Apr-18 1:55
mvpJochen Arndt6-Apr-18 1:55 
GeneralRe: How can I initialize an array of structs where the array size is set at compile time? Pin
arnold_w6-Apr-18 2:30
memberarnold_w6-Apr-18 2:30 
AnswerRe: How can I initialize an array of structs where the array size is set at compile time? Pin
Jochen Arndt6-Apr-18 0:36
mvpJochen Arndt6-Apr-18 0:36 
GeneralRe: How can I initialize an array of structs where the array size is set at compile time? Pin
arnold_w6-Apr-18 1:32
memberarnold_w6-Apr-18 1:32 
GeneralRe: How can I initialize an array of structs where the array size is set at compile time? Pin
Jochen Arndt6-Apr-18 2:13
mvpJochen Arndt6-Apr-18 2:13 
AnswerRe: How can I initialize an array of structs where the array size is set at compile time? Pin
Joe Woodbury6-Apr-18 7:06
professionalJoe Woodbury6-Apr-18 7:06 
Questionwhy ( const char *ptr = string literal ) works but ( const string *ptr = string literal ) doesn't ? Pin
Tarun Jha3-Apr-18 8:53
memberTarun Jha3-Apr-18 8:53 
#include <iostream>
#include <string>
using namespace std;

int main(){
     const char *ptr = "tarun" ;
    //const string *name = "tarun";

    cout << name << endl ;
    return 0;
}


in the above code if i assign a string literal to a const char*
Quote:
const string *name = "tarun";

it prints the string but the same with string gives error that
Quote:
cannot convert ‘const char’ to ‘const string

so it means any string literal is a const char (which i think is a rvalue),
but it is a collection of characters, so how is it a char ? and if it is a char then why it is called string literal ?
please explain.
Thank you.
AnswerRe: why ( const char *ptr = string literal ) works but ( const string *ptr = string literal ) doesn't ? Pin
Victor Nijegorodov3-Apr-18 10:03
memberVictor Nijegorodov3-Apr-18 10:03 
AnswerRe: why ( const char *ptr = string literal ) works but ( const string *ptr = string literal ) doesn't ? Pin
David Crow3-Apr-18 11:41
memberDavid Crow3-Apr-18 11:41 
AnswerRe: why ( const char *ptr = string literal ) works but ( const string *ptr = string literal ) doesn't ? Pin
leon de boer3-Apr-18 14:48
memberleon de boer3-Apr-18 14:48 
QuestionHelp compiling OpenCV Pin
_Flaviu3-Apr-18 0:25
member_Flaviu3-Apr-18 0:25 
AnswerRe: Help compiling OpenCV Pin
Victor Nijegorodov3-Apr-18 3:04
memberVictor Nijegorodov3-Apr-18 3:04 
GeneralRe: Help compiling OpenCV Pin
_Flaviu3-Apr-18 3:08
member_Flaviu3-Apr-18 3:08 
GeneralRe: Help compiling OpenCV Pin
_Flaviu3-Apr-18 3:08
member_Flaviu3-Apr-18 3:08 
GeneralRe: Help compiling OpenCV Pin
Victor Nijegorodov3-Apr-18 5:08
memberVictor Nijegorodov3-Apr-18 5:08 
AnswerRe: Help compiling OpenCV Pin
Jochen Arndt4-Apr-18 0:02
mvpJochen Arndt4-Apr-18 0:02 
QuestionCreating a Simple Employee Database using inheritance in c++. Pin
Tarun Jha2-Apr-18 1:53
memberTarun Jha2-Apr-18 1:53 
SuggestionRe: Creating a Simple Employee Database using inheritance in c++. Pin
Richard MacCutchan2-Apr-18 1:57
protectorRichard MacCutchan2-Apr-18 1:57 
GeneralRe: Creating a Simple Employee Database using inheritance in c++. Pin
Tarun Jha2-Apr-18 1:59
memberTarun Jha2-Apr-18 1:59 
GeneralRe: Creating a Simple Employee Database using inheritance in c++. Pin
Richard MacCutchan2-Apr-18 2:10
protectorRichard MacCutchan2-Apr-18 2:10 
GeneralRe: Creating a Simple Employee Database using inheritance in c++. Pin
Tarun Jha2-Apr-18 3:32
memberTarun Jha2-Apr-18 3:32 
AnswerRe: Creating a Simple Employee Database using inheritance in c++. Pin
Richard MacCutchan2-Apr-18 2:19
protectorRichard MacCutchan2-Apr-18 2:19 
GeneralRe: Creating a Simple Employee Database using inheritance in c++. Pin
Tarun Jha2-Apr-18 2:19
memberTarun Jha2-Apr-18 2:19 
GeneralRe: Creating a Simple Employee Database using inheritance in c++. Pin
Richard MacCutchan2-Apr-18 2:26
protectorRichard MacCutchan2-Apr-18 2:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Cookies | Terms of Service
Web05 | 2.8.181207.3 | Last Updated 10 Dec 2018
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid