C Pointers

c-pointers.jpg

Pointers in C

Pointers in C are clean, and learning a laugh. Some C language tasks are accomplished with guidance more easily, and other duties, including the complex reminiscence distribution, can not be done by using pointers. So learning hints in becoming a super C programmer will become important.

What are the Pointers?

In C language, the guidelines are basically a variable that is acknowledged to save the deal with another variable, and the variable may be types, array, function, int, char, or any other pointer from these. However, in a 32-bit layout, the architecture is responsible for the size of the pointer, the measurements of a pointer are simply 2 bytes.

For instance, an integer variable holds (or you might say stores) an integer value, but an integer pointer holds an integer variable's address. With the aid of examples, we will be speaking guidelines in the C programming tutorial.

The general type of a statement for a pointer variable is −

type *var-name;

KEY POINTS TO REMEMBER ABOUT POINTERS IN C:

  • A normal variable stores the price whereas the pointer variable shops the cope with of the variable.
  • The content material of the C pointer always is an entire quantity i.E. cope with.
  • The C pointer is always initialized to null, i.e. Int * p = nonzero.
  • The value of the null pointer is 0.
  • The & symbol can be used to get the variable's address.
  • * symbol is used to get the fee of the variable that the pointer is pointing to.
  • If NULL is assigned to a pointer in C it indicates that it points to nothing.
  • Two pointers can be subtracted to recognize how many factors are available between these pointers.
  • But, Pointer addition, multiplication, division are not allowed.
  • The length of any pointer is 2 byte (for the 16-bit compiler).


PROGRAM EXAMPLE ON POINTERS IN C:

#include<stdio.h>  
int main(){  
int num=10;    
int *p;      
p=&num ;    
printf("Print the Address of p variable = %x \n",p);      
printf("Print Value of p variable = %d \n",*p);     
return 0;  

Read More...
Also, Visit Here  C Programming Tutorial






Comments

Popular posts from this blog

C Tutorial

Switch Statement in C