In the below code, I have initialised an empty string 'a' and now I am arbitrarily trying to print any value out of it. Please help me understand why it does not show any error and prints garbage value instead!
#include <iostream>
#include <string>
using namespace std;
int main() {
string a = "";
for(int i=0;i<10;i++)
cout<<a[i];
for(int i=0;i<10;i++)
cout<<(int)a[i];
cout<<"|";
cout<<"\n"<<a.size();
}