0% found this document useful (0 votes)
6 views3 pages

C Programming Practical File

The document is a practical file for a C programming course focused on pointers, double pointers, and triple pointers. It includes definitions, example programs, and explanations demonstrating how these pointers work in accessing variable addresses and values. The conclusion emphasizes the importance of pointers in memory handling and efficient coding in C.

Uploaded by

jamilahmad9028
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views3 pages

C Programming Practical File

The document is a practical file for a C programming course focused on pointers, double pointers, and triple pointers. It includes definitions, example programs, and explanations demonstrating how these pointers work in accessing variable addresses and values. The conclusion emphasizes the importance of pointers in memory handling and efficient coding in C.

Uploaded by

jamilahmad9028
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

C PROGRAMMING PRACTICAL FILE

Name: Your Name


Branch: Your Branch (CSE/IT/etc.)
Subject: C Programming
Practical No: 2
Title: Pointer and Multi-Level Pointer Program

Aim

To study and implement pointers, double pointers, and triple pointers in C.

Theory

A pointer is a variable that stores the address of another variable.

 A single pointer stores the address of a variable.

 A double pointer stores the address of a pointer.

 A triple pointer stores the address of a double pointer.

These are useful for dynamic memory allocation and complex data structures.

Program 1: Pointer Example

#include <stdio.h>

void main()

int a = 10;

int *ptr;

ptr = &a;

printf("Value of a = %d\n", a);

printf("Address of a = %u\n", &a);

printf("Pointer ptr stores address = %u\n", ptr);


printf("Value of a using pointer = %d\n", *ptr);

Output

Value of a = 10
Address of a = (some memory address)
Pointer ptr stores address = (same address)
Value of a using pointer = 10

Explanation

 ptr = &a stores the address of variable a

 *ptr gives the value stored at that address

Program 2: Multi-Level Pointer Example

#include <stdio.h>

void main()

int ***r, **q, *p, i = 5;

p = &i;

q = &p;

r = &q;

printf("%d %d %d", *p, **q, ***r);

Output

555

Explanation

 *p gives value of i
 **q accesses p then i

 ***r accesses q → p → i

All print the same value.

Conclusion

Pointers and multi-level pointers allow indirect access to variables and are very important in C
programming for memory handling and efficient coding.

You might also like