C Programming : Pointer

How to Declare Pointer | Declaring Pointer in C Programming ?

How to Declare Pointer in C Programming ? Syntax of Pointer in C : data_type * pointer_name ; Explanation : data_type Type of variable that the pointer points to OR data type whose address is stored in pointer_name Asterisk(*) Asterisk is called as Indirection Operator It is also called as Value at address Operator It(…)

Different Pointer Operator in C Programming

Pointer Operator in C Program To Create Pointer to a variable we use ‘*’ , ‘&’ Operator [ we have nothing to do with multiplication and Logical AND Here ] ‘&’ operator is called as address Operator ‘*’ is called as ‘Value at address’ Operator ‘Value at address’ Operator gives ‘Value stored at Particular address.(…)

What is Pointer ? : Understanding Pointer in C Programming

Understanding pointers in c ? Pointer is a variable which stores the address of another variable Since it is a variable , the pointer itself will be stored at different memory location. In C Programming we have 2 types of variables - [arrowlist] Simple Variable that stores a value Complex Variable that stores address of(…)

Illegal Arithmetic Operations with Pointer

One can perform different arithmetic operations on Pointer such as increment,decrement but still we have some more arithmetic operations that cannot be performed on pointer - Addition of two addresses. Multiplying two addresses. Division of two addresses. Modulo operation on pointer. Cannot perform bitwise AND,OR,XOR operations on pointer. Cannot perform NOT operation or negation operation.(…)

What is Null Pointer ?

What is Null Pointer ? NULL Pointer is a pointer which is pointing to nothing. NULL pointer points the base address of segment. NULL is macro constant which has been defined in the header file stdio.h alloc.h mem.h stddef.h stdlib.h as - #define NULL 0 Visual Representaion : Some Examples of NULL Pointer float *ptr=(float(…)

Importanat Pointer Arithmatics : Formulae

Pointer Arithmatics : Formulae Expression Result Address + Number Address Address - Number Address Address - Address Number Address + Address Illegal   Pointer Home Bookmark & Share

Multiple Indirection / Double Pointer Concept in C

Program : #include<stdio.h> #include<conio.h> void main() { int i =50; int **ptr1; int *ptr2; clrscr(); ptr2 = &i; ptr1 = &ptr2; printf(“\nThe value of **ptr1 : %d”,**ptr1); printf(“\nThe value of *ptr2 : %d”,*ptr2); getch(); } Output : The value of **ptr1 : 50 The value of *ptr2 : 50 Explanation : Variable ‘i’ is initialized(…)

C Program to Swap two Numbers Using Function and Pass By Reference

C Program to Swap two Numbers Using Function and Pass By Reference #include<stdio.h> #include<conio.h> void swap(int *num1,int *num2); void main() { int x,y; printf(“\nEnter First number : “); scanf(“%d”,&x); printf(“\nEnter Second number : “); scanf(“%d”,&y); printf(“\nBefore Swaping x = %d and y = %d”,x,y); swap(&x,&y); // Function Call - Pass By Reference printf(“\nAfter Swaping x(…)

How to Read Complex and Difficult Pointer in C Programming ?

Before We Learn How to Read Complex Array we should first know precedence and associative . Precedence : Operator precedence describes the order in which C reads expressions Associativity : Order operators of equal precedence in an expression are applied Before Reading Article You Should know Precedence and Associative Table Operator Precedence Associative (),[] 1(…)

Causes of Dangling Pointer in C

Dangling Pointer in C Dangling pointers arise when an object is deleted or deallocated, without modifying the value of the pointer, so that the pointer still points to the memory location of the deallocated memory. In Short Pointer Pointing to Non-Existing Memory Location is called Dangling Pointer. There are different ways where Pointer acts as(…)