Latest web development tutorials

C Exercise Example 95

100 cases of classic C language 100 cases of classic C language

Title: Simple structure application examples.

Program Analysis: None.

Source Code:

//  Created by www.w3big.com on 15/11/9.
//  Copyright © 2015年 本教程. All rights reserved.
//

#include <stdio.h>

struct programming
{
    float constant;
    char *pointer;
};

int main()
{
    struct programming variable;
    char string[] = "本教程:http://www.w3big.com";
    
    variable.constant = 1.23;
    variable.pointer = string;
    
    printf("%f\n", variable.constant);
    printf("%s\n", variable.pointer);
    
    return 0;
}

Run the above example output is:

1.230000
本教程:http://www.w3big.com

100 cases of classic C language 100 cases of classic C language