• Skip to main content
  • Skip to primary sidebar
  • Skip to secondary sidebar
  • Skip to footer

Computer Notes

Library
    • Computer Fundamental
    • Computer Memory
    • DBMS Tutorial
    • Operating System
    • Computer Networking
    • C Programming
    • C++ Programming
    • Java Programming
    • C# Programming
    • SQL Tutorial
    • Management Tutorial
    • Computer Graphics
    • Compiler Design
    • Style Sheet
    • JavaScript Tutorial
    • Html Tutorial
    • Wordpress Tutorial
    • Python Tutorial
    • PHP Tutorial
    • JSP Tutorial
    • AngularJS Tutorial
    • Data Structures
    • E Commerce Tutorial
    • Visual Basic
    • Structs2 Tutorial
    • Digital Electronics
    • Internet Terms
    • Servlet Tutorial
    • Software Engineering
    • Interviews Questions
    • Basic Terms
    • Troubleshooting
Menu

Header Right

Home » C » Structure and Union

Manipulation of Complex Numbers by Structures

By Dinesh Thakur

A complex number is also a multivalue object. It consists of two parts: real part and imaginary part. The imaginary part carries symbol i which is equal to √-1 . A complete number is written as sum of the real part and the imaginary part as shown below. [Read more…] about Manipulation of Complex Numbers by Structures

Vectors with Structures in C

By Dinesh Thakur

Since structures are multivalue, multitype data objects, they can be considered to form a useful tool in manipulation of quantities such as vectors, complex variables, etc. For this we define functions of the type struct, i.e., the return value of the function is a structure. The function may have arguments of type struct besides other arguments. Let us define a structure with three components of vector as its data members as shown below. [Read more…] about Vectors with Structures in C

Sorting of Structures in C

By Dinesh Thakur

When structures are used to keep record of employees, students, and so on, we would need to sort them according to some criterion. For employees, it may be according to alphabetical order, designation, or pay. [Read more…] about Sorting of Structures in C

C Program to Structure as a Parameter of Functions

By Dinesh Thakur

Program provides an illustration of a function with structure as one of its parameter. The function calculates and returns the magnitude of a vector which is an instance of structure defined to hold the three components of a vector as its data members. The structure is declared as below. [Read more…] about C Program to Structure as a Parameter of Functions

C Program to Pointers to structures

By Dinesh Thakur

Pointers to structures may be declared as we declare pointers to any other data type. Like arrays and functions, the name of structure carries the address of the structure where the values of its various members are stored. Therefore, the pointer may be initialized by the name of structure which is a constant pointer to the structure. Program illustrates the declaration and use of pointer to a structure. [Read more…] about C Program to Pointers to structures

Typedef with Nested Structures in C

By Dinesh Thakur

We have used the declaration of nested structures on the parent structure in the same declaration. The structures may also be declared separately and included in the parent structure. The innermost structure should be declared first, then the next enveloping structure and then the next enveloping structure. The code is illustrated in Program. [Read more…] about Typedef with Nested Structures in C

Typedef in Structure Declaration in C

By Dinesh Thakur

In this method, the declaration starts with typedef followed by key word struct. The data members of the structure are placed between a pair of curly braces after struct. The type name is placed after the closing right brace (}). This is explained in the following example: [Read more…] about Typedef in Structure Declaration in C

Union in c

By Dinesh Thakur

As we already know, a structure is an ordered list of elements of either the same or different types. A union is similar to a structure but with one major difference that the structure stores all its members one after another, whereas the union can store only one member at a time, since all the members in a union are stored beginning from the same memory location. Thus, the total memory required to store a union is the same as that required for the largest member in it. The union is useful when we have to store one of the alternative values of different types and yet conserve space. [Read more…] about Union in c

C Program to read and print info of a person

By Dinesh Thakur

The program given below reads the information about a person and prints it on the screen. It uses a structure containing a pointer member name to represent the information about a person. Note that the program uses the dstr_read function. [Read more…] about C Program to read and print info of a person

C Program determine the frequency of words in a given string

By Dinesh Thakur

A program to determine the number of words and average word length is given in Program. It uses the strtok function to separate the words in a given string. The program given below uses the same technique to separate the words in a given string and determine and print the frequency of these words. [Read more…] about C Program determine the frequency of words in a given string

Structure Containing Arrays in C

By Dinesh Thakur

The C language allows an array to be used as a structure member. This enables us to group related structure members and is also useful for declaring character strings as structure members. This section explains how we can effectively use such structures. This includes [Read more…] about Structure Containing Arrays in C

C Program using structures and functions, to compare two dates

By Dinesh Thakur

Consider the problem of comparison of two valid dates d1 and d2. There are three possible outcomes of this comparison: d1 == d2 (dates are equal), d1 > d2 (date d1 is greater, i.e., occurs after d2) and d1 < d2(date d1 is smaller, i.e., occurs before d2). Let us write a function that accepts two dates as structures dl and d2 of type struct date and returns 0 if the dates are equal, 1 if d1 is later than d2 and -1 if date dl is earlier than d2. [Read more…] about C Program using structures and functions, to compare two dates

C Program to add of two complex numbers

By Dinesh Thakur

Let us use structure complex to represent a complex number and write a simple program containing only the main function. Thus, we can define structure complex either in the main function or before it as a global definition. [Read more…] about C Program to add of two complex numbers

What is Structures and Unions

By Dinesh Thakur

Structures and Unions, Giving values to members, Initializing structure, Functions and structures, Passing structure to elements to functions, Passing entire function to functions, Arrays of structure, Structure within a structure and Union. [Read more…] about What is Structures and Unions

Advantages of Unions

By Dinesh Thakur

Union is a collection of data items of different data types. It can hold data of only one member at a time though it has members of different data types. If a union has two members of different data types, they are allocated the same memory. [Read more…] about Advantages of Unions

Define a Structure with suitable program

By Dinesh Thakur

A structure is a user-defined data type containing a collection of logically related data which may be of different types such as int, double, char, and so on. All of them are encapsulated (packed) in a single unit with a single name. The classes of C++ are in fact generalization of C-structures. A class in C++ with only public members is similar to a C-structure. All members of a structure in C are by default public. However, in a class declaration in C++, if there is no access specifier, the members are private by default. We know that arrays can be used to represent a group of data items that belong to the same type, such as int or float. This restriction is not there in structures. [Read more…] about Define a Structure with suitable program

Primary Sidebar

C Programming

C Programming Tutorials

  • C - History
  • C - Anatomy
  • C - Constants
  • C - Identifiers
  • C - Data Types
  • C - Libraries File
  • C - Header Files
  • C - Basic Language
  • C - Data Types Sizes
  • C - Header Files Importance
  • C - Escape Sequences
  • C - Main() Purpose
  • C - Program Procedure
  • C - Control Statements
  • C - Enumeration Constant
  • C - Add numbers
  • C - Return Statement
  • C - Avoid Goto
  • C - Command Line Arguments
  • C - Switch Case
  • C - Switch Case Limitations
  • C - getchar() and putchar()
  • C - Iteration Statements
  • C - Pass by Value and Reference
  • C - Structures and Unions
  • C - Structure
  • C - Dynamic Memory
  • C - Fgets and Fputs Functions
  • C - Gets() and Puts() Functions
  • C - Armstrong Number
  • C - Storage Classes
  • C - Fibonacci Series
  • C - Precision Setting
  • C - const Parameters

C - Variable & It's Type

  • C - Variables
  • C - Variable Lifetime
  • C - Static Variable
  • C - Register Variable
  • C - Global Variables
  • C - Auto Variables
  • C - Local Variables

C - Operator & Expressions

  • C - Operator
  • C - Boolean Operators
  • C - Bitwise Operator
  • C - Arithmetic Operators
  • C - Modulus Operator
  • C - Ternary Operator
  • C - Expressions
  • C - Arithmetic Expressions

C - Array

  • C - Arrays
  • C - Array Types
  • C - Array Characteristics
  • C - Static Arrays
  • C - Global Arrays
  • C - 3D Arrays
  • C - Dynamic Arrays
  • C - Pointer to 3D Arrays
  • C - Array Elements Hold
  • C - Arrays as Function Parameters
  • C - Accessing Matrix Elements
  • C - File Handling
  • C - Matrix Multiplication
  • C - Dynamic Memory Allocation

C - Searching & Sorting

  • C - Data Structures
  • C - Linear Search
  • C - Bubble Sort
  • C - Merge Sort
  • C - Linked List
  • C - Insertion Sort
  • C - Binary Search
  • C - Selection Sort
  • C - Quick Sort

C - Functions

  • C - Functions
  • C - Functions Advantages
  • C - Void Functions
  • C - Function Call
  • C - Default Return Value
  • C - String functions

C - Pointer

  • C - Pointers
  • C - Type Casting Of Pointers
  • C - Pointer Advantages
  • C - Pointers Initialization
  • C - Vectors and Pointers

C - Differences

  • C - C Vs C++
  • C - Formal Args. Vs Actual Args.
  • C - Keywords Vs Identifiers
  • C - Strings Vs Character Arrays
  • C - Address Vs Dereference Operator
  • C - Goto Vs longjmp
  • C - Declaring Vs Defining Variable
  • C - String Vs Array
  • C - Call by Value Vs Reference
  • C - Structure Vs Union
  • C - For Vs While loops
  • C - Compiler Vs Interpreter

C - Programs

  • C Program Standard Deviation
  • C Program Calculate Tax
  • C Program Sum Series
  • C Program Merge Arrays
  • C Program Euclid’s Algorithm
  • C Program Print Weekdays
  • C Program Sum of Digits
  • C Program Print a list
  • C Program Print Pythagorean
  • C Program Quiz program
  • C Program Display Table
  • C Program Print Comma-Separated
  • C Program Prints Prime Numbers
  • C Program for Print Integer
  • C Program Count Number
  • C Program Print Color Name
  • C Program Print Odd Numbers
  • C Program Calculate area
  • C Program for a Menu
  • C Program Add Two Vectors
  • C Program Array Addresses
  • C Program Division by Zero Error
  • C Program Compare two Dates
  • C Program Tower of Hanoi
  • C Program return 3 Numbers
  • C Program for Prime Numbers
  • C Program for Factorial
  • C Program for Palindrome

Other Links

  • C Programming - PDF Version

Footer

Basic Course

  • Computer Fundamental
  • Computer Networking
  • Operating System
  • Database System
  • Computer Graphics
  • Management System
  • Software Engineering
  • Digital Electronics
  • Electronic Commerce
  • Compiler Design
  • Troubleshooting

Programming

  • Java Programming
  • Structured Query (SQL)
  • C Programming
  • C++ Programming
  • Visual Basic
  • Data Structures
  • Struts 2
  • Java Servlet
  • C# Programming
  • Basic Terms
  • Interviews

World Wide Web

  • Internet
  • Java Script
  • HTML Language
  • Cascading Style Sheet
  • Java Server Pages
  • Wordpress
  • PHP
  • Python Tutorial
  • AngularJS
  • Troubleshooting

 About Us |  Contact Us |  FAQ

Dinesh Thakur is a Technology Columinist and founder of Computer Notes.

Copyright © 2025. All Rights Reserved.

APPLY FOR ONLINE JOB IN BIGGEST CRYPTO COMPANIES
APPLY NOW