Home » C programs

C pointers example programs

C Language Pointers -Pointers are the main and very useful feature of C programming. Pointers are special kind of variable by its amazing features; these are the variables that can store address of another variable.

Pointers can stores address of another variables, can access value of that variable (which address is stored in the pointer variable), can assign value to that variable too.

Here are some features of pointers

  • By using pointers we can get multiple values from the function, as we know a function can return only one value but by passing arguments as pointers we can get more than one values from the pointer.
  • By using pointers dynamic memory can be created according to the program use. We can save memory from static (compile time) declarations.
  • By using pointers we can design and develop complex data structures like STACK, QUEUE, LINKED LIST etc.
  • Amazing feature of pointes: Pointers provide direct memory access.

Here are some disadvantages of the pointers

Since pointers has many features but there are some disadvantages of pointers

  • Failed to protect memory addresses (locations) - Since pointer can access direct memory so memory cannot be protected.
  • Uninitialized pointers can cause of segmentation fault.
  • Pointers variables are slower than normal variables.
  • Pointers always required Free Memory for Dynamically Allocated Memory.

Here are the lists of some solved c programming pointers solved programs/examples for your practice, all programs have source code with output and explanation. This section contains solved programs on pointers, pointers with simple variable, pointers with conditional and control statements, array and pointers, pointers with strings, structure and unions.

List of C pointers Programs

  1. Program to create, initialize, assign and access a pointer variable.
  2. Program to swap two numbers using pointers.
  3. Program to change the value of constant integer using pointers.
  4. Program to print a string using pointer.
  5. Program to count vowels and consonants in a string using pointer.
  6. Program to read array elements and print with addresses.
  7. Program to read and print student details using structure pointer, demonstrate example of structure with pointer.
  8. Program to print size of different types of pointer variables.
  9. Program to demonstrate example of double pointer (pointer to pointer).
  10. Program to demonstrate example of array of pointers.
  11. An Example of Null pointer in C
  12. Making a valid pointer as NULL pointer in C
  13. Modify value stored in other variable using pointer in C

List of other C programs

  1. C program to declare memory for an integer variable dynamically.
    Dynamic Memory Allocation Example: In this C program, we are will declare an integer pointer and allocate memory for an integer variable at run time using malloc().
  2. C program to read and print name, where memory for variable should be declared at run time.
    Dynamic Memory Allocation Example: In this C program, we will declare memory character array (to read name) at run time, will read name and print the string.
  3. C program to find sum of array elements using Dynamic Memory Allocation.
    Dynamic Memory Allocation Example: In this C program, we will declare memory for array elements (limit will be at run time) using malloc(), read element and print the sum of all elements along with the entered elements.
  4. C Program to find the sum of digits of a number until a single digit is occurred.
    C Program to find the sum of digits of a number until a single digit is occurred (without using recursion or iterative(loop) statements).
  5. C program to find class of an IP Address.
    This program will print the class of a given (user input) IP address.
  6. Stringizing Operator in C - Program to print variable name in C.
    This program will print the variable name using stringizing operator.
  7. Function Pointer example program in C programming.
    This program demonstrate an example of function pointer in c programming language.
  8. C program to get current System Date and Time in Linux.
  9. C program to implement gotoxy(),clrscr(),getch(),getche() for GCC, Linux.
  10. C program to find the size of a file in Linux.
  11. C program to get Process Id and Parent Process Id in Linux.
  12. fork() function explanation and examples in Linux C.
  13. C program to Get Computer System IP Address in Linux.
  14. C program to Set Computer System IP Address in Linux.
  15. C program to design flying characters Screen Saver.
  16. C program to design a TIC TAC TOE game.
  17. Age Calculator (C program to calculate age).
  18. C program to design love calculator.
  19. C program to guess a random number.
  20. C program to check given string is a valid IPv4 address or not.
  21. C program to convert String into Hexadecimal.
  22. C program to demonstrate example of Variable Arguments.
  23. C program to store time in an integer variable.
  24. C program to store date in an integer variable.
  25. C program to remove consecutive repeated characters from string.
  26. C program to create your own header file.
  27. EMI Calculator (C program to calculate EMI).
  28. C program to validate date (Check date is valid or not).
  29. C program to format/extract ip address octets.
  30. C program to implement substring function.
  31. C program to design a digital clock.
  32. C program to convert hexadecimal Byte to integer.
  33. C program to extract bytes from an integer (Hexadecimal) value.
  34. C program to print character without using format specifiers.
  35. C program to find Binary Addition and Binary Subtraction.
  36. C program to print weekday of given date.
  37. C program to calculate compound interest.

Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.