structure is a C language and a type of storage data, then how to implement a structure of a simple can store 1000 people information of the phone book? First, you need to define a structure, including a person's information (such as name, gender, age, telephone, address, etc.). Let's start by defining a struct.typedef struct PDHB-INFO {char name[5];Char sex[3];int age;Char tele[12];Char addr[30]; }pdhb-inf
C language-Address Book, C language address bookBlack/white address book -- 1 -- Requirement Analysis1.1 requirements1.2 prototype display1.3 Function Analysis-- 2 -- code implementation2.1 external declarations, variables, macros2.2 module implementation
[Written at the beginning :]
"The UI interface is used to it.
[C language crazy handout] (16) C language simple Address Book (not optimized version), handout address book
Knowledge points used in Address Book Development
Usage of constants and variables
Global Variables
Branch statement
Function
Macro
Loop statement
Scanf and printf
[C Language] implements an address book, C language address bookImplement an address book;The address book can be used to store information of 1000 people. The information of each person includes:Name, gender, age, phone number, and addressMethod:1. Add contact information2.
body variables
MyStr * pstr = (mystr*) malloc (sizeof (MYSTR));
Pstr->p = "ABC";
Note that if the dynamically generated struct variable (malloc) is used, the memory space must be freed (with free) before the variable is discarded.If a dynamically generated object exists within the structure, the internal memory space is released before releasing the structure, as follows
Pstr->p = (char*) malloc (sizeof (char) *256);
Free (pstr-
same, and the 5th member variable may be score or course. When the value of the 4th member variable is s, the 5th member variable is score, and when the value of the 4th member variable is T, the 5th member variable is course.
With the above analysis, we can design a structure that contains a common body, see the following code:
#include
Run Result:
Input Info:hanxiaoxiao 501 F S 89.5↙Input info:yanweimin 1011 M T Math↙Input Info:liuzhenta
descriptor is an operating system array (the index of the Open file list). Each array element consists of a file control block (FCB, the file controls blocks) that the operating system uses to manage specific files. Standard input, standard output, and standard errors are handled using the file pointers stdin, stdout, and stderr.
2, C language file operation of the underlying implementation of the introduction
2.1 File Structure
I used to be confused about the use of the common Body Union when I was learning C language at school. After work to discover some of its magical, now for example:1. To facilitate the understanding of the code.For example, to write a 3 * 3 matrix, you can write this:[Note: The following parts marked with red are added later, thanks to Yrqing718 's reminder.] ]struct Matrix {union {struct {float _f11, _f12,
I know what you're thinking: cracking your body language in seven daysBasic InformationAuthor: (beauty) Jenny deliverPress: CITIC PressISBN: 9787508635316Mounting time:Published on: February 1, September 2012Start: 32Page number: 320Version: 1-1Category: Economic Management
For more information, I know what you are thinking: cracking your body
C-language function calls when the reference operation on the 32-bit x86 machine relies on the stack. But in the x86_64 machine uses some registers as auxiliary, but if the parameter is too many, the register is not enough to use, at this time also must use the stack operation to implement the parameter. Although the C language does not explicitly limit the number of function pass arguments ( Depending on t
, intermediate readers, I hope you have a lot of support.Many beginners often have this kind of confusion, "Why I read the book, C # related to all aspects of knowledge, but it is impossible to write a decent application?" ”,This actually still did not learn to use the knowledge comprehensively, exercise out of programming thinking, build up learning interest, I think the series of articles may help you, I hope so.Development environment: VS2008This s
, intermediate readers, I hope you have a lot of support.Many beginners often have this kind of confusion, "Why I read the book, C # related to all aspects of knowledge, but it is impossible to write a decent application?" ”,This actually still did not learn to use the knowledge comprehensively, exercise out of programming thinking, build up learning interest, I think the series of articles may help you, I hope so.Development environment: VS2008This s
the world's top bull and Google's strong commitment to support, And after our group of love toss the yard of the full test and testing to confirm, why not. As the saying goes, it is not our blind adventures to make decisions with Go, but the clear conclusion that we first ate crabs a few years ago and have been tested by practice.
When using Go language programming, in addition to the official website publicly accessible documents, can refer to a v
Use a linked list to implement address book and language learning address book
The main function of this program is to add, delete, search, insert, and display contact information.
(Call the linked list operation interface, please refer to: http://blog.csdn.net/qlx846852708/article/details/43482497)
Here is the detailed implementation process of the linked list o
Concept of struct type:
A struct is a collection of data that contains a single number.
The C language provides a structured data type as a collection to handle this complex data, and a struct can combine multiple single information together as a whole to use. When using a struct, you first declare the type of struct you need, in general form Shi:
struct structure Body name {
Data type 1, struct member 1;
D
Learn about the benefits of body language:Personally, human body language is very important, the proportion of each type of work is different, if in those who usually work with others should be accounted for more than 50% , in daily life and the 20-30% ; (The percentage above is estimated by the individual);Learn about the benefits of
[SOURCE DOWNLOAD]Indispensable Windows Native (8)-C language: struct, common body, enumeration, type definitionWebabcdIntroducedEssential C language of Windows Native
Structural body
Shared body
Enumeration
Type-defined character
ExampleCStruct.h#if
value of age will not be retained.Because they are using the same space, remember that.
Because all of the properties of a common body use one storage space, the total size of the shared body is based on the member who needs the maximum storage space.Perhaps the first time people who have heard of the shared body will be confused, in fact, the common
Designmodo website has published an article "Why is " Thebody Language of theWeb? , the article said, the speaker through body language can make their expression more fully, so that the audience easier to understand themselves. The designer's website is the body language of
principle of a common body--%d\n",sizeof(FISR)); //define a common bodyUnion Stu Stuinfo;//common body definition form ②//assignment of a common bodySTUINFO.A = +; //shared body variable at any time, only one member exists, and when a member is present, it is assigned to the other member, which is overwritten by the previous//because a common
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.