Can a variable declared as public be used in the main function?

Can you clarify with an example? Are you talking about something declared as public within a class? You can certainly use the . operator: (in main you declare) myclass myobject; myobject.mypublicvar = 10; Something like that?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.