Address operator and pointers, Operating System

Assignment Help:

  We are use to using variables within C without thinking about where they are stored. Most variables are dynamic i.e. can change, therefore they are stored in Ram, unlike a program once developed is static i.e. doesn't change; this is often storage in EPROM or Rom. We can directly access the address where the variable is stored by means of the address operator '&' .This returns the address of the variable followed i.e.

printf("The address of var A is %lx and the contents of var A is %x",&a,a) 
This address is often fixed by the compiler and cannot be altered easily, very often we want initialize the address of a variable and vary it, C uses the concept of the pointer to handle this. A pointer is a variable which holds an address (This is in fact an address register on the 68Hc11 i.e. X, Y). We can explicitly load up the variable with any number (address which we like) and perform simple mathematical functions on it i.e. add, mul, sub etc. In order to declare the variable as a pointer we need to prefix it with a * in its declarations i.e.

      int *point;  
      char *point; 
      float *point;

The type of pointer  used describes the size of the data to be read  i.e. a char pointer reads 7 bits of data , unsigned char 8 bits i.e. (some programmers use sizeof function to get actual machine size).

    char * point  == 7 bits
     unsigned char * point  == 8 bits
     int * point  == 15 bits
     unsigned int  * point  == 16 bits
     float * point  == 31 bits
     unsigned float  * point  == 32 bits

Related Discussions:- Address operator and pointers

What do you mean by first fit, What do you mean by first fit? First fit...

What do you mean by first fit? First fit allocates the first hole that is big sufficient .Searching can either start at the starting of the set of holes or where the previous f

Ipc, Explain in detail about ipc in linux

Explain in detail about ipc in linux

Determine the task of the pass ii in a two-pass assembler, Determine the ta...

Determine the task of the Pass II In a two-pass assembler Synthesize the target program is the task of the Pass II

Why system calls have to be implementing by a interpreter, Q. What system c...

Q. What system calls have to be implementing by a command interpreter or shell in order to start a new process? Answer: In the UNIX systems a fork system call followed by an ex

What are the benefits of multithreaded programming, What are the benefits o...

What are the benefits of multithreaded programming? The advantages of multithreaded programming can be broken down into four main categories: Responsiveness Resourc

Diehard allocator - custom allocators, Allocators can also be used to avoid...

Allocators can also be used to avoid problems with unsafe languages. C and C++ are pervasive, with huge amounts of existing code. They are also memory-unsafe languages, in that the

Explain doscreatethread functions used in the os/2, Explain DosCreateThread...

Explain DosCreateThread Functions Used in the OS/2  DosCreateThread(&threadID,MyThreadFunction,arg,flags,stackSize) DosCreateThread creates a thread within the context of th

Need of shift alteration in critical section problem?, Explain with an exam...

Explain with an example the need of Shift Alteration in critical section problem? Consider processes P i and P j and consider the algorithm for P i and P j .

Explain the advantage of assembly language, Explain the Advantage of Assemb...

Explain the Advantage of Assembly Language The advantages of assembly language program is: a)    Reduced errors  b)    Faster translation times  c)    Changes could be ma

Explain the fork function, Explain the Fork Function Fork function caus...

Explain the Fork Function Fork function causes a new process to be created. The calling progress is duplicated as an exact copy (called the child process) that differs only in

Write Your Message!

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd