Knowledge Walls
Venkatesan
Hyderabad, Andhra Pradesh, India
Passcode:
Introduction [cont'd]
Input Output Functions [cont'd]
Structures and Unions [cont'd]
# Preprocessor [cont'd]
Define Structure in Structures and Unions of Programming in C
2281 Views
Define Structure 
Structure is a grouping of multiple derived datatypes under one type. It is one of the type of user-defined datatype. For example Student tables has multiple group of members. Like rno, name and age.
Syntax 
struct structure_name {
variables declaration;
};
Program
	#include
	void main(){
	   struct book{
	       int book_no;
	       char book_name[20];
	       char author[20];
	   };
	    //Structure initialization
	    struct book cpp = {1001,"CPP","ST Anthony"};
	    struct book java;
	    printf("%d : %s : %s\n",cpp.book_no,cpp.book_name,cpp.author);
	    //Assigning values to memebers
	    java.book_no = 1002;
	    strcpy(java.book_name,"Java Programming");
	    strcpy(java.author,"Dennis kumar");
	    printf("%d : %s : %s\n",java.book_no,java.book_name,java.author);
	}
Output 
1001 : CPP : ST Anthony
1002 : Java Programming : Dennis kumar
Next Topics
Next lessons of current book.
Structures and Unions of Programming in C
Structures and Unions of Programming in C
Structures and Unions of Programming in C
Structures and Unions of Programming in C
Structures and Unions of Programming in C
Previous Topics
Previous lessons of current book.
User-defined Functions of Programming in C
User-defined Functions of Programming in C
User-defined Functions of Programming in C
User-defined Functions of Programming in C
User-defined Functions of Programming in C
Best Lessons of "Programming in C"
Top lessons which are viewed more times.
Structures and Unions of Programming in C
Input Output Functions of Programming in C
Structures and Unions of Programming in C
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details