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

List some basic data types in c?

1025


What do you mean by c what are the main characteristics of c language?

1031


Why main is not a keyword in c?

1250


what are the advanced features of functions a) function declaration and prototypes b) calling functions by value or by reference c) recursion d) all the above

1120


Explain what is the stack?

1097


write a program to print largest number of each row of a 2D array

2323


What are local variables c?

1009


What are the types of pointers?

1109


Write a code to generate a series where the next element is the sum of last k terms.

1222


How do you define structure?

1041


What is the scope of local variable in c?

1121


Who developed c language?

1086


What is p in text message?

978


What is getch c?

1294


What does %c mean in c?

1081