// Today, the teacher asked me to use a struct Function does a function pointer loop All of a sudden I didn't know struct How to use the function I went down to look up a lot of information

The first definition is :

int fun1(){
    struct student{
        int age;
        int nume;
    }
    struct student stu={10,20};
}

The second definition

int fun2(){
    struct student{
        int age;
        int nume;
    }stu={10,20};
}

The third definition

int fun(){
    struct {
        int age;
        int nume;
    }stu={10,20};
}

All calls need printf("%d",stu.age); Printed as 10;

The difficulty is pointer calling

struct Person{
    int age;
};

void fun(){
    struct Person person = {27};
    struct Person *p;
    p=&person;
    printf("%d",person.age);
    printf("%d",(*p).age);
    printf("%d",p->age);// The three call methods are the same
}

int main(int argc, const char * argv[]) {
    fun();
    return 0;
}

struct More articles on functions

  1. About struct Functions and overloads

    1, On the application of its function We can see from here that ,void,int,Node, There are three types , It's all definable . 2, The way of overloading How to overload comparison symbols The comparison overload here is the less than sign , If the former x Than the latter x Back to the truth when I was young Otherwise return false ...

  2. matlab Structure array of struct

    The following is from :https://blog.csdn.net/u010999396/article/details/54413615/ To be in MALTAB To achieve more complex programming , You can't do without struct type . ...

  3. matlab Basic data structure struct

    Let's learn evolutionary computing together -matlab Basic data structure struct If it's useful , Welcome to discuss and learn from each other ~Follow Me reference http://blog.sina.com.cn/s/blog_46865140 ...

  4. MATLAB Array of cells cell And the structure struct The usage and difference of

    1. Preface Matlab Array of cells cell And the structure struct Can integrate different types of related data into a single variable , It makes the processing of a large number of related data very simple and convenient . however , It should be noted that , Cell arrays and structs just carry ...

  5. matlab in struct Create method

    MATLAB in struct Creation methods can be divided into : Direct creation method and struct() Function creation method (1) Create directly : Define fields directly , It's like using matlab The variables are the same , There's no need to declare , Support dynamic expansion . So let's create one Studen ...

  6. Matlab Data types in

    Matlab There is 15 Basic data types , It's mainly integer . floating-point . Logic . character . Date and time . Structure array . Cell arrays, function handles, etc .         1. integer :(int8:uint8:int16:uint16:int3 ...

  7. MATLAB Array of structures in

    MATLAB Array of structures in Structure array : A structure is a data type that contains a set of records , The records are stored in the corresponding fields . The fields of the structure can be any MATLAB Variables or objects of data type . Structure type variables can also be one-dimensional . Two dimensional or multidimensional ...

  8. Matlab Basic data type

    Reprinted from :http://hi.baidu.com/xmf6227/blog/item/97ca2ddf98f1b61f495403cb.html Matlab There is 15 Basic data types , It's mainly integer . floating-point ...

  9. Scripting language :Xmas( Two )

    This article , Let's talk about the type system , And part of the garbage collector related content . One . Basic types Xmas Basic type :Null.Boolean.Label.String.Ref.Function.Integer.Float.De ...

Random recommendation

  1. Bootstrap < Foundation 18 > Breadcrumb navigation (Breadcrumbs)

    Breadcrumb navigation (Breadcrumbs) It's a display mode based on the hierarchical information of the website . Take blogs for example , Breadcrumb navigation shows the release date . Category or label . They represent the position of the current page within the navigation hierarchy . Bootstrap Breadcrumbs in the navigation ( ...

  2. CTO Do something ?

    1. Responsible for Technology 2. Responsible people 3. In charge of the business ( demand ) 4. Be responsible for organizing

  3. AFNetworking Basic use

    AFNetwork It's a lightweight network request api Class library . In order to NSURLConnection, NSOperation And other methods . The following example is used to deal with json Requested 3 How to choose AFNetwork ...

  4. Swift note

    Apple official documents https://developer.apple.com CocoaChina Help document http://www.cocoachina.com/special/swift/ 74 individual Swift mark ...

  5. 8 Kind of Nosql Database system comparison

    Reading guide :Kristóf Kovács Is a software architect and consultant , He recently released a film comparing various types of NoSQL Database articles . although SQL Databases are very useful tools , But through 15 Monopoly is about to be broken after a solo show in . This one ...

  6. Baidu web Front end interview 2015.10.18

    I will attend Baidu school recruitment interview at 2 pm on Sunday , I 13:10 That's the minute , The front desk asked me to get an interview qualification list first ( It's my message ), And then in web Front end interview entrance line up , The interview was held in Baidu canteen , Wait a little bit 1 Hours , Let me go for an interview . It's all a couple ...

  7. mysql Use experience

    SET FOREIGN_KEY_CHECKS=0; -- ------------------------------ Table structure for `staff`-- ---------- ...

  8. [ turn ] machine learning ——C4.5 Decision tree algorithm learning

    1. Algorithm background Classification tree ( Decision tree ) It's a very common classification method . It's a kind of regulatory learning , The so-called regulatory learning is very simple , That is, given a bunch of samples , Each sample has a set of attributes and a category , These categories are predetermined , So get a point through learning ...

  9. directx11 Programming errors encountered and solutions

    (2016-05-10)xnamath.h Report errors : In the identifier "XMConvertToRadians" In front of An error is as follows : >d:\program files\microsoft ...

  10. MySQL Of bigint type

    bigint The size range of supported numbers is :19 position , Save the phone number . There is a range of symbols :-9223372036854775808 To 9223372036854775807 int The number range supported is :10 position , There is a range of symbols :- ...