[Solved] Not getting output in case of string
You are using an uninitialized string, so assigning a to s[0] does nothing or does undefined behavior. To do this, you have to give s a size, as the options below: Option 1: Resize #include <bits/stdc++.h> using namespace std; int main() { string s; s.resize(10); s[0] = ‘a’; cout << s << endl; return 0; … Read more