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

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

  • Subtract two numbers using method overriding
  • PHP Star triangle Pattern program
  • Using function or method to Write temperature conversion : Fahrenheit into Celsius
  • Function or method:temperature conversion from Fahrenheit into Celsius – Entered by user
  • Write temperature conversion program: Fahrenheit into Celsius
  • How to write a program to convert Fahrenheit into Celsius

tag

Addition (6) Array (38) C++ language (91) C language (98) c sharp (23) Division (6) Function (29) if else (32) Java language (102) JavaScript (5) loops (137) Multiply (7) Oop (2) patterns (65) PHP (13) Python Language (38) Subtraction (7) temperature (20)

Archives

Categories

Address

Global information technology

Puloly south, PointPedro

Jaffna

Srilanka

©2025 Code for Java c | Powered by SuperbThemes