We Want to Store the value a=10 by pointer in any one memory location. After some Time we can change the value of the a and also doe snot change the memory location. how?
Printable View
We Want to Store the value a=10 by pointer in any one memory location. After some Time we can change the value of the a and also doe snot change the memory location. how?
Could you explain the question in detail giving sample variables?
[QUOTE=kaliswaranbsc;15788]We Want to Store the value a=10 by pointer in any one memory location. After some Time we can change the value of the a and also doe snot change the memory location. how?[/QUOTE]
hi friend
let me to put answer;
#include<stdio.h>
#include<conio.h>
void main(
)
{
int a=100, *p;
p=&a;
printf("\n The address of a=%u and value of a=%d",&a,a);
printf("\n P holding the address is =%u",p);
a=a+10;
printf("\n The address of a=%u and value of a=%u",&a,a);
printf("\nP holding the number is =%u",p);
getch();
}
try this u will get answer .
[QUOTE=kaliswaranbsc;15788]We Want to Store the value a=10 by pointer in any one memory location. After some Time we can change the value of the a and also doe snot change the memory location. how?[/QUOTE]
hi friend
let me to put answer;
#include<stdio.h>
#include<conio.h>
void main()
{
int a=100, *p;
p=&a;
printf("\n The address of a=%u and value of a=%d",&a,a);
printf("\n P holding the address is =%u",p);
a=a+10;
printf("\n The address of a=%u and value of a=%d",&a,a);
printf("\nP holding the number is =%u",p);
getch();
}
try this u will get answer .
Thankyou verymuch for answer my Dought sir,
and i have another dought how to find the sizeof interger or float with out using sizeof() operator.
Hi Friend Try this Piece of Code:: :)
int main()
{
printf("Size of int : %d bytes\n",sizeof(int));
printf("Size of short int : %d bytes\n",sizeof(short int));
printf("Size of long int : %d bytes\n\n", sizeof(long int));
printf("Size of char is %d byte\n",sizeof(char));
getch();
return 0;
}
Regards,
Shine ;)
hi friend
i want some C & C++ questions for Aptitude please send
thank u