Basic Programs
If Else based Programs
Loop Based Programs
Array Based Programs
String Programs
Function Programs
Pointers Programs
Structure & File Handling Programs
Data Structure Programs
Structure and File Handling programs
Book structure program
#include <stdio.h> #include <conio.h> void main() { struct book { int pages; float mrp; };
struct book b1,b2; //how to take input in structure variable. printf("enter the details for first book."); scanf("%d", &b1.pages); scanf("%f", &b1.mrp);
printf("enter the details for second book."); scanf("%d", &b2.pages); scanf("%f", &b2.mrp);
// similarly to print the structure variable. printf("details for first book"); printf("pages= %d price=%f\n", b1.pages, b1.mrp); printf("details for second book"); printf("pages= %d price=%f\n", b2.pages, b2.mrp); }
Output of the above program is as following.
Video/ C Introduction
Watch video in full size