Basic use of structures

Source: Internet
Author: User

//basic use of structures#include <stdio.h>intMain () {//1. Defining the structure type    structPerson {//which variable is inside, is the struct member or the implementation        intAge ; Doubleheight; Char*name;    }; //2. Define struct variables according to struct type    structPerson p = { in,1.44,"Jack"};//What is inside the parentheses, p is the variable name of the struct. //p = {} and array-like definitions. 29 is assigned to age, and 1.44 assigns a value to the Height,jack assigned to the nameP.age= -;//and Here I love the age and name more.P.name ="Rose"; printf ("Age =%d, name =%s, height =%f\n", P.age, P.name, p.height); structPerson p2={2,2.33,"rrrr"    }; //struct person p2= {. height= 2.44,. name= "RRR"};             return 0;}

Basic use of structures

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.