How do i set values to exposed variables using CreateWidget in c++?

“Exposed on Spawn” is only relevant in BP.

In C you would set the values as you would any other property. If they’re public, you can just set them. If they’re private you can use a Setter method.

UMyWidgetClass* MyNewWidget = T<UMyWidgetClass>CreateWidget(Owner, MyWidgetClassPtr);

if (MyNewWidget) {
  //set public variable
  MyNewWidget->MyPublicFloat = 1.0f;

  //set private variable using setter method defined in your widget class
  MyNewWidget->SetMyPrivateFloat(5.0f);

}