how to add numbers without using arithmetic operators.
Answer Posted / lookog
int add2(int a,int b)
{int s;
char *p=(unsigned)a;
s=&p[b];
return(s);
}
The previous soln with int would not be accurate, as int
storage is platform dependent. char is 1 bytes mostly.p[b]
is equivalent to *(p+b) and already p=a has been set.
though result is coming for -1000,-1000, not sure what it
means physically(address of -2000 ?)
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
How to declare a variable?
code for quick sort?
Difference between goto, long jmp() and setjmp()?
When reallocating memory if any other pointers point into the same piece of memory do you have to readjust these other pointers or do they get readjusted automatically?
What is the package for freshers(Non IIT) in amazon(hyderabad). And what is the same for those who are a contract employee.
Write a code of a general series where the next element is the sum of last k terms.
What do you mean by Recursion Function?
How can you restore a redirected standard stream?
What is hungarian notation? Is it worthwhile?
can any one please explain, how can i access hard disk(physical address)? it is possible by the use of far,near or huge pointer? if yes then please explain......
What is else if ladder?
What standard functions are available to manipulate strings?
If jack lies on Mon, Tue Wed and jill lies on Thursday, Friday and Saturday. If both together tell they lied yesterday. So c the given options and then c cos in the given dates one will be saying the truth and one will be lying. I got Thursday as option because jack is saying the truth he lied yest but jill is lying again as he lies on that day.
State the difference between realloc and free.
What are the types of operators in c?