I have two types of structure variable initialization in my code.
Example
#include<iostream>
#include<string>
using namespace std;
struct Data{
int arr[5];
float x;
};
int main(){
struct Data d = {0};
struct Data d1 = {};
cout<<d.arr[0]<<d.x;
cout<<d1.arr[0]<<d1.x<<endl;
return 0;
}
I am running the code ad getting 0 0 0 0 as my output. Please help me, is there any difference between both initialization.
c
because it involves syntax common to c and c++ is incorrect but it's not "spamming." – Latashialatch