Problem Solving using C Language

0 of 77 lessons complete (0%)

Pointers

Practice: Pointers

1. Basic Pointer Operations

  • Write a program to declare an integer pointer, assign it the address of an integer variable, and print the value and address of the variable using the pointer.
  • Write a program to swap two numbers using pointers.
  • Write a program to find the sum of two numbers using pointers.
  • Write a program to find the largest of three numbers using pointers.
  • Write a program to demonstrate pointer arithmetic (incrementing, decrementing a pointer, accessing elements using a pointer).

2. Pointer with Arrays

  • Write a program to input and print elements of an array using pointers.
  • Write a program to find the sum of all elements in an array using a pointer.
  • Write a program to reverse an array using pointers.
  • Write a program to sort an array using pointer-based bubble sort.
  • Write a program to find the largest element in an array using pointers.

3. Pointer with Strings

  • Write a program to input a string and print it using a pointer.
  • Write a program to count the number of vowels and consonants in a string using pointers.
  • Write a program to reverse a string using a pointer.
  • Write a program to compare two strings using pointers.
  • Write a program to concatenate two strings using pointers.

4. Pointer to Pointer

  • Write a program to declare a pointer to a pointer and demonstrate how to access the value of a variable using it.
  • Write a program to swap two variables using pointer-to-pointer.
  • Write a program to demonstrate a multi-level pointer (pointer to pointer to pointer).