using pointers this program is violating encapsulation rule-
class MyClass
{
int i;
public:
int j;
MyClass(int temp1,int temp2){i=temp1;j=temp2;}
Type: Posts; User: mannu1200
using pointers this program is violating encapsulation rule-
class MyClass
{
int i;
public:
int j;
MyClass(int temp1,int temp2){i=temp1;j=temp2;}
So the question is -
//will this code runs slower-
for (int i = 0; i < strlen(str); i++)
{......}
//compare to this-
Yes I know that but still i was trying to understand the fundamentals.....
okae it will stored in stack while function calling but in the 2nd case it will get stored in stack as well as in memory....
now i think it will save memory
i think it doesnt
for supporting my answer-
when we pass a string like this-
abcd("hello");
instead of-
char *str = "hello";
abcd(str);
it still get stored in the memory and the base address...
My question is simple..
so will this code save an integer memory ?
printf("%d",abcd());
//compare to-