Can a struct have a constructor in C++?
struct
I have been trying to solve this problem but I am not getting the syntax.
Yes it possible to have constructor in structure here is one example:
#include struct a { int x; a(){x=100;} }; int main() { struct a a1; getch(); }