#include <iostream>
using namespace std;
int add(int a, int b)
{
int sum = a + b;
return sum;
}
char* print()
{
char arr[] = "Hello";
char buffer[6];
strcpy_s(buffer,arr);
return buffer;
}
int main(){
cout << add(2,3)<< endl; // This prints "5"
cout << print() <<endl; // This prints junk!!!!
}
1) add(2,3) print 5, how the value is ratained in this case considering print() function which returns pointer
2) Where 2 functions stored. Both will be stored in stack i guess, Why is print() function isnot printing "Hello" then