Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Is c is a low level language?

1145


Can a function argument have default value?

1157


How the c program is executed?

1162


the statement while(i) puts the entire logic in loop. this loop is called a) indefinite loop b) definite loop c) loop syntax wrong d) none of the above

1055


largest Of three Number using without if condition?

1606


Differentiate between declaring a variable and defining a variable?

1048


How can I do peek and poke in c?

1082


What is difference between %d and %i in c?

1241


How do I determine whether a character is numeric, alphabetic, and so on?

1140


WRITE A CODE IN C TO SEARCH A FILE FROM NOTEPAD FILE.

2449


Explain what will the preprocessor do for a program?

1072


What is putchar() function?

1166


Write a program to print factorial of given number without using recursion?

996


What's the best way of making my program efficient?

1110


What does the message "automatic aggregate intialization is an ansi feature" mean?

1190