how to write a data 10 in address location 0x2000
Answers were Sorted based on User's Feedback
Answer / vishnu
int main()
{
int *ptr;
ptr = (int *)0x2000;
*ptr = 10;
printf("%d", *ptr);
}
| Is This Answer Correct ? | 5 Yes | 1 No |
The below line u can use for the question asked, provided
the address is not pointing to any OS memory, system files
or any location on ROM memory.
0x2000 is invalid address(Access voilation)in my system. So
I tried with the valid address 0x12FF70 to get the o/p.
main()
{
*(int *)(0x12FF70)= 20;
printf("%d \n",*(int *)(0x12FF70));
getch();
}
O/p would be 20.
| Is This Answer Correct ? | 1 Yes | 0 No |
What are the usage of pointer in c?
Is printf a keyword?
Why c is a procedural language?
how does a general function , that accepts an array as a parameter, "knows" the size of the array ? How should it define it parameters list ?
Do variables need to be initialized?
who developed c and why he developed c?
What are operators in c?
what will be the output off the following program? #include<stdio.h> int main() { int a; a=015+0*71+5; printf("%d,a"); return0; }
What are the preprocessor categories?
In C programming, what command or code can be used to determine if a number of odd or even?
In C language what is a 'dangling pointer'?
What is a structure and why it is used?