he you are not clear about your question..............
tc..............
2006-11-02 02:37:59
·
answer #1
·
answered by raghav 2
·
0⤊
0⤋
may be i m not that much clear about what ur question is but still trying to put my views on this...
See... Swaping replacing the contents of one container to another and vice versa.... here u must require atleast 2 containers.
U can certainly swap the values using 3 or 2 variables but if u have only 1 container holding a value then where is the second value .. what thing/container is holding the other value.. ?
so i suppose u can swap contents of one container in to nothig or nowhere .. ! do u ?
ok .. do one thing .. show me how u take 2 inputs in one variable and i will show u how to swap it ..
.
.
.
.
.
.
.
but still ... least i can think is ..this ..
void main()
{
int a=10; // only one variable
printf("b = %d",a); //display value in a i.e 10
scanf("%d",&a); // scan new value in variable a
printf("a = %d",a) // display new value
}
2006-11-02 09:00:41
·
answer #2
·
answered by Digitally Й!Й 3
·
0⤊
0⤋
Heyy dude , i don't think thr is any way 2 swap 2 values using only 1 variable.
2006-11-02 09:09:23
·
answer #3
·
answered by Dx 2
·
0⤊
0⤋
What exactly do you want to do?
Do you want to exchange the values of TWO variables? Do you want to know what the current value AND the previous value of a variable are?
2006-11-02 08:51:31
·
answer #4
·
answered by Samuel G 1
·
0⤊
0⤋
i guess u mean register rather registry, well i not into c coding so i dont remember exact dos library function but rest of palls his question is answerable and clear too... i did it during my college days but i dont remember code any more :( i think it was some AX or BX register which was used to hold last input value..
another complicated way is to read buffer which stores screen content, it was some 0x0000080 kinda address
2006-11-02 11:20:10
·
answer #5
·
answered by utsav v 2
·
0⤊
0⤋
May be this will answer ur question
main()
{
int a, b;
printf("Enter two numbers A, B : ");
scanf("%d %d", &a, &b);
a^=b^=a^=b; /* swap A and B */
/*or
a=a+b;
b=a-b;
a=a-b;
/*or
/*One more way,
a = a*b
b = a/b
a = a/b*/
printf("\nA = %d, B= %d\n", a, b);
}
2006-11-02 11:15:22
·
answer #6
·
answered by Deeps_rock 2
·
0⤊
0⤋
Even if you can do this, I dont see any practical use.
2006-11-03 04:09:26
·
answer #7
·
answered by manoj Ransing 3
·
0⤊
0⤋
please go to www.codeguru.com
you will get the result
2006-11-02 09:01:45
·
answer #8
·
answered by Pummy 2
·
0⤊
0⤋
dunno pal
2006-11-02 08:52:03
·
answer #9
·
answered by amazed !!! 4
·
0⤊
0⤋