To check for overflow, use condition:

if (b > (maxuint-a))
  return error;

Where maxuint is the largest value which can be stored in an unsigned
integer.

Don

On Jul 8, 5:50 am, vikas <mehta...@gmail.com> wrote:
> Q1 - write a generic macro to swap two values (int,float,double,pointers as
> well )
>
> Q2 - Implement your own malloc() and  free() function
>
> Q3 - Two unsigned ints given a, b ....you have add these numbers and return
> the sum ...Make sure in case of overflow return "error".

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to