Implement sizeof operator using bitwise operation [closed] - sizeof

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
During an interview for the position of C/C++ , I faced one question Write a c program to implement sizeof operator ,I have wrote the code ,Then he asked me to implement using bitwise operations .I tried for int.... But I coudlnt ,,,, anyone can post the code ,, how to implement ,,,

You cannot do this, since the set of data types that support bitwise operations is not a superset of the set of types that support sizeof.
Proof: int*.

Related

String comparison function (c++) [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I am looking for a function to compare the two strings. A functional similar to strcmp in CString with the difference that takes two strands in the input.
You can use std::string::compare (it returns 0 if values are the same). Also be aware that in fact you can use strcmp in c++, but if you want modern c++ version i would go with std::string::compare.

CPP intresting thing with conditionsl statement [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
if(cout<<"h"){}
this gives me an output
h
Any idea why, I have tried many variations of it and it still works.
That's because the if statement needs to evaluate the condition you give into it, plus, streams are implicitly convertible to bool.

c++ evaluating string expression with variables [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I want to do evaluate for example something like:
int x=10, y=2;
x=eval('x+(y*10)');
i can give you the code which i made, but would like you to try yourself. Here are the steps :
replace all the unknowns with their values
convert the expression to postfix
try to evaluate postfix expression using stacks

How operator overloading in C++ impacts on performance? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I was given a question: how operator overloading in C++ impacts on performance?
I'm not pretty sure how to answer it. I fully understand the idea and how to overload operators in C++, but what about performance?
Calling an overloaded operator is the same as calling any function in the object. If you mark the operator as inline, you get the same benefits (or lack thereof) as any other inline function.
Nothing complicated at all.

How to make a MATLAB function to be run in html? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I've developed a MATLAB code that I think it is useful to be used by researchers. How can I embed it in a website to be used free?
It gets two integers and return a set of integers
Also it is possible to convert it to c++, If it helps.
Thanks
Submit your m-file(s) to Matlab Central File Exchange, this is the perfect place for it.