typedef struct OLNODE{int i,j;int data;Olnode *right,*down;The object Olnode of the}olnode,*olink;//structure, pointer to the structure *olink,Can write like thisstruct olnode{};Olnode Olnode, *olink;Divided into three pieces to tell:1 First://Note different in C and C + +To define a struct type in C, use a typedef:
1. Basic explanation
Typedef is a key word in C language. It defines a new name for a data type. The data types here include internal data types (INT, Char, etc.) and Custom Data Types (struct, etc ).
In programming, typedef is generally used for two purposes. One is to give a variable a new name that is easy to remember and clear, and the other is to simplify so
Typedef is a key word in C language. It defines a new name for a data type. When typedef is used in combination with the structure, there will be some complicated situations, and there is a slight difference between the C language and C ++. This article will explain in detail the usage of typedef struct.
Chapter 1 Diff
Define a struct in C to use a TypeDef, such as:typedef struct STUDENT { int A;} Stu;Thus, when declaring variables, it is possible to: Stu STU1; (assuming that no typedef is required to use a struct Student stu1; declare). Here the Stu is actually the alias of
#include using namespacestd;structtest{intA;} Test;//the struct type test is defined and the variable is declared directly by Test D;//If you use a TypeDef, there will be a difference.structtest1{intA;} test11; //test11 is a variabletypedefstructtest2{intA;} test22; //test22 is a struct type. ==struct test2//when
To1 struct telphone{23 char name[]; 4 5 Char teinumber[]; 6 };As an example, we first define a telphone structure.Join needs to define an alias for Telphone:Its syntax istypedef Telphone TP;And actually telphone as a struct,It's better to write like thisTepedef struck Telphone TP;Because our telphone is our custom type, so we understand, but others do not necessarily understand, i
Typedef and custom struct types.
The typedef keyword is used for customizing struct types. we all know that typedef refers to an alias. const, # define, and so on are easily obfuscated in C. The difference is not discussed in this article.
/* Define the node type of a sing
struct How to define a structure
First type:
#include
use struct {xxx;} t; directly define struct variables
The second type:
#include
Use struct node {XXX} t; define struct node and define a variable t
You can then use the
instructor Haobin, instructor Haobin's int array cannot be auto-incrementing. Author: leonard's Writing Time: March 23, 2014 */typedef struct Arr {int * pBase; // pointer to the first address of the int array int length; // The maximum length of the current array int cnt; // The number of current elements int increment; // The increment of the array} Arr; void init_arr (Arr * arr, int len ); void selfincre
1. Basic explanation
TypedefIt is a keyword in C language and defines a new name for a data type. The data types here include internal data types (INT, Char, etc.) and Custom Data Types (Struct).
Used in programmingTypedefThere are two purposes: one is to give a variable a new name that is easy to remember and clear, and the other is to simplify some complicated type declarations.
AsTypedefWhat are the nuances? Let's take a look at the specific expl
/** Structure for a SQL data tuple of fields (logical record)*/structdtuple_struct {ulint info_bits; /*!*/Ulint N_fields; /*! number of fields in Dtuple*/Ulint n_fields_cmp; /*!which should is used in comparison services of rem0cmp.*; The index search is performed by comparing-these, others is ignored; The default value in Dtuple creation is the same value as N_fields*/dfield_t* Fields;/*! Fields*/ut_list_node_t (dtuple_t) tuple_list; /*!*/#ifdef univ_debug ulint magic_n; /*!*//** Value of Dtupl
Look at the code these days and see several types of structures, such as the following structure declarations:struct book{String name;int price;int num;};This structure defines the format of the structure variable such as the following:struct book student;struct book{String name;int price;int num;}student;This form represents the process of declaring the structure and the process of defining the structure variable is merged into one steptypedef
Today, I want to integrate the Tcl script interpreter into an application. Encountered a strange problem.
The problem code is as follows:
// Tclstduio. h: the main header file of the tclstduio application
The stdafx. h file contains the TCL. h file.
The following error is reported during compilation:
1> ------ build started: Project: tclstduio, configuration: Debug Win32 ------1> tclstduioview. cpp1> E:/my project/tclstduio. H (39): Error c2143: syntax error: Missing '; 'before '*'1> E:/my proj
After reading the data structure of Mr. Haobin, I am very touched. So I want to write a series of articles about the data structure-whether you simply learn the data structure, for the purpose of preparing for the preliminary test and review of the data structure of the postgraduate entrance exam, I believe you can all benefit from this series of blog posts.
Environment: windows xp (x86), vc ++ 6.0
Intention: If you want to learn the data structure well, you must be familiar with the structures,
same effect as int * a; int * B; indicates that two integer pointer variables are defined. PINT2 a, B; has the same effect as int * a, B; indicates defining an integer pointer variable a and an integer variable B.
1. First, the execution time of the two is different.
The keyword typedef is valid in the compilation phase. Because it is in the compilation phase, typedef has the type check function.
Define is
:
char * name, * sign;
However, let's assume that:
#define STRING char *;
So:
STRING name, sign;
It will be translated into the following form:
char *name,sign;
In this case, only name is a pointer.
You can also use typedef for the structure:
typedef struct complex{ float real; float imag;}COMPLEX;
In this way, you can replace
C ++ those details -- typedef keyword, details -- typedef keyword
I. About the typedef keyword. I used to use it to redefine the struct alias when I learned the C language. Later I used some function pointers, but I don't know how to use them. Today, I will take some time to summarize the details of
institutions.
SOURCE two: (http://www.ccfans.net/bbs/dispbbs.asp?boardid=30id=4455)The use of TypeDef in C language1. Basic explanationA typedef is a keyword in the C language that defines a new name for a data type. The data types here include internal data types (Int,char, etc.) and custom data types (struct, etc.).There are two commonly used
Chapter One: The difference between typedef struct and struct1. Basic explanationsA typedef is a C-language keyword that defines a new name for a data type. The data types here include the internal data type (INT,CHAR, etc.) and the custom data type (struct, etc.).The purpose of using
hides long, incomprehensible template-specific syntax, such as: basic_string
Author Profile Danny KalevA certified system analyst who specializes in C ++ and formal language theory. He was a member of the C ++ Standards Committee from 1997 to 2000. Recently, he completed his master's thesis on general linguistics with outstanding achievements. In his spare time, he enjoys listening to classical music, reading Victorian literature, and studying natural languages such as Hittite, Basque, and Ir
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.