answersLogoWhite

0


Best Answer

How do you do.

I am doing well thank you.

Swap two number by using reference operators

A tough assignment, it will make you think.

I think you are confusing reference operators with pointers.

Were I you I would study the section on pointers in your text book or course material.

User Avatar

Wiki User

13y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

9y ago

void swap(int* x, int* y) { return *x^=*y^=*x^=*y; }

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

May be it is impossible without using arithmetic operators

Following code must work in C

a = a^b;

b = a^b;

a = a^b;

Or else try using registers.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you swap two numbers without using third one using pointers?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How to write a C program to find largest 2 numbers using pointers?

program to find maximum of two numbers using pointers


How do you find the biggest of n numbers using pointers in C?

yes


Program in c using pointers to interchange 2 values without using third variable?

swap (int *pa, int *pb) { *pa ^= *pb; *pa ^= *pa; *pa ^= *pb; }


What will be the program to arrange numbers stored in array in ascending order using pointers?

sorry


How do you write 3rd march 2011 without using numbers?

Third March, two thousand and eleven.


Is it possibly to return an array of strings in a function without using pointers in C plus plus?

No.


What is program in c to swap entered two numbers without using third variable?

The required c program is given below /*Swapping(interchange) the two entered numbers*/ #include<stdio.h> main() { /*Without using third variable*/ int a,b,t; printf("Enter a:"); scanf("%d",&a); printf("Enter b:"); scanf("%d",&b); a=a+b; b=a-b; a=a-b; printf("\n After swapping without using third variable"); printf("\na=%d\nb=%d",a,b); }


How to perform string operations like concatenation compare etc without using built in functions?

performing string operation using pointers


How do you write third June 2011 in 5 letters without using numbers?

Just a guess: KEVIN (3rd June 2011 is Kevin's name day)


What are restricted pointers in C99?

Using this you specify that two pointers can't point on the same address


Why are header files not required when using far and near pointers?

In C programming, header files are required. It doesn't matter if you are using near pointers, far pointers, both, or neither -- you still need header files. There is no connection between the necessity of header files and the pointers' size.


What are the applications of pointers in using c language?

Accessing data by address. Some data-structures, like lists and trees, are usually implemented using pointers.