Answer the question
In order to leave comments, you need to log in
How to name pointers?
How to name pointers? What would be clearer? Let's say here is the code, how do I call the pointer s?
#include <iostream>
#include <string>
using namespace std;
struct Conteiner
{
string Name;
int X;
int G;
int H;
};
int main()
{
Conteiner conteiner1 = {"Del", 45, 6, 34};
Conteiner* s = &conteiner1;
cout << s -> Name << endl;
cout << s -> X << endl;
system("pause");
}
Answer the question
In order to leave comments, you need to log in
In this example, no way. This variable is not needed here, instead of it you can write wherever you need an address &conteiner1
. For the sake of saving one character, having another variable is a bad idea.
If you have some kind of function that needs a pointer, then you can specify it Conteiner* conteiner
as an argument or something else that makes more sense.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question