how to write a data 10 in address location 0x2000

Answers were Sorted based on User's Feedback



how to write a data 10 in address location 0x2000..

Answer / vishnu

int main()
{
int *ptr;
ptr = (int *)0x2000;
*ptr = 10;
printf("%d", *ptr);
}

Is This Answer Correct ?    5 Yes 1 No

how to write a data 10 in address location 0x2000..

Answer / vatsava

int main()
{
int *ptr;
ptr = (int *)2000;
*ptr = 10;
printf("%d", *ptr);
}

Is This Answer Correct ?    1 Yes 0 No

how to write a data 10 in address location 0x2000..

Answer / vadivel t

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

Post New Answer

More C Interview Questions

What is data types?

0 Answers  


What should malloc() do?

0 Answers  


Explain what is the heap?

0 Answers  


What does nil mean in c?

0 Answers  


program in c to print 1 to 100 without using loop

9 Answers   Wipro,






Explain what is a 'locale'?

0 Answers  


What is 1d array in c?

0 Answers  


What is the general form of function in c?

0 Answers  


What is sizeof array?

0 Answers  


what is the associativity of bitwise OR operator?

1 Answers  


Do you know what is the purpose of 'extern' keyword in a function declaration?

0 Answers  


What is use of pointer?

0 Answers  


Categories