Question #46780

#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...

Expert's answer

#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");
}
LATEST TUTORIALS
APPROVED BY CLIENTS