0
Can someone explain?
In my code I'll try to have a string variable into switch. Because this is imposible I made a pointer like this so I can put it as integer. int *pntr_hypo pntr_hypo = &hypo and then compiler shows me an error: error: expected initializer before 'pntr_hypo' I tried to initialise it but I'm not sure what I should do. Can you help me?
5 Answers
+ 2
variable hypo must be defined. every line finish with semicolon
int hypo;
int* pntr_hypo;
pntr_hypo = &hypo;
I publish this code in the Code Playground as "pointer c plus plus"
0
hypo is string
0
since hypo is a string, use:
string hypo;
string *hypo_ptr;
hypo_ptr = &hypo;
0
The problem is into switch. It doesn't accept it.
0
As I know you can't put string variable in switch