Skip to content
Menu
Code for Java c
  • Home
  • Java
    • Java Examples
    • Java tutorials
  • C
    • C tutorials
    • C Examples
  • C++
    • C++ Tutorials
    • C++ Examples
  • Python
    • Python Tutorials
    • Python Examples
  • About
    • About me
    • contact us
    • disclaimer
    • Privacy Policy
Code for Java c

Structure with pointer in C language

Posted on October 13, 2017September 29, 2019
 
Structure with pointer
Structure

Table of Contents

  • Structure with pointer in C language
    • Structure with normal variable
    • Structure with pointer variable
    • Related

Structure with pointer in C language

In this tutorial, we will discuss the concept of Structure with pointer in C language.
In C language, Structure can be created and accessed using pointers.
 
Structure can be accessed in 2 ways in the C Program
Usually, Dot(.) operator is used to access the data member’s normal structure variable but the arrow is used to access the data members using pointer variable.
  1. Using normal structure varaible
  2. Using pointer variable

 

We are explaining below, how can access structure using two methods
It is a syntax for structure with pointer
Here, ptr is a pointer to structure

Structure with normal variable

This is a program to C structure using normal variable

Structure with pointer
Structure ,example

When the above program is executed, it produces the following results

Enter employee details
12 kannan male 34 250000
your Employee Details here
……………………………………..
Id is :12
Name is :kannan
Gender is :male
Age is :34
salary is 250000.000000

Structure with pointer variable

This is a program to C structure using pointer variable

Structure with pointer
Structure example
 
When the above program is executed, it produces the following results

Enter employee details :..
16 harini female 57 30000
………………………………….
your employee details here
Id is :16
Name is : harini
Gender is :female
Age is :57
Salary is :30000,000000

 

Related Post

Structure in C Language                                            Structure in C++ Language
Structure with function in C Language                    Structure with function C++ Language
Structure with pointers in C++
Function in C Language                                              
 
Nested function  in C       
 
Nested Structure in C Language 

Related

Recent Posts

  • Multiply two numbers in Java using scanner| 5 different ways
  • 5 different ways to Divide two numbers in Java using scanner
  • Learn 8 Ways to Subtract Two Numbers Using Methods in Java
  • 10 ways to subtract two numbers in Java
  • Java Code Examples – Multiply Two Numbers in 5 Easy Ways
  • How to Divide two numbers in Java| 5 different ways

tag

Addition (8) Array (38) C++ language (91) C language (98) c sharp (23) Division (8) Function (29) if else (32) Java language (108) JavaScript (5) loops (138) Multiply (8) Oop (2) patterns (66) PHP (13) Python Language (38) Subtraction (9) temperature (20)

Archives

Categories

Address

Global information technology

Puloly south, PointPedro

Jaffna

Srilanka

©2026 Code for Java c | Powered by SuperbThemes