#include<stdio.h>
int a=10;
main()
{
int a=20;
printf ("%d",a);
}
question : output of the code is a=20 but i want also print the old value of a (10), with out using pointers ? or suggest me other possible methods too...
1
Expert's answer
2014-09-25T09:42:56-0400
#include<stdio.h> #include<stdlib.h> //value a int a=10; //main method void main(){ int a=20; //print 20 printf ("%d\n",a); //print 10 printf ("%d\n",::a); //delay system("pause"); }
Comments
Thank you! We've corrected answer and category.
no u should do this with SRO(scope resolution operator) then u can also access also the old value of variable(a)
Leave a comment