zoukankan      html  css  js  c++  java
  • C 语言基本知识

    C 语言基本知识

    1. 堆和栈,以及常用内存块

    (1) 栈(stack): 由编译器自动分配释放 ,存放函数的参数值,局部变量的值等。其操作方式类似于数据结构中的栈;

    (2) 堆(heap): 一般由程序员分配释放, 若程序员不释放,程序结束时可能由OS回收 。注意它与数据结构中的堆是两回事,分配方式倒是类似于链表。

    2. 结构体(struct)

    #include<stdio.h>
    
    // Only define of struct
    struct struct1{
        char name[20];
        float height;
        char job[20];
    };
    struct struct1 student1 = {"s1",180,"IT"};
    
    // Define first and instantiation
    struct stuct2{
        float name[20];
        float height;
        char job[20];
    }student2;
    student2.name[0] = 's';
    student2.height = 190;
    student2.job[0] = 't'; 
    
    // typedef
    typedef struct _struc{
        char name[20];
        float height;
        char job[20];
    }stuc_test;
    stuc_test student3 = {"s3",200,"IT"}; // stuc_test equals to struct _struc
    
    int main()
    {
        printf ("student1 info: 
    ");
        return 0;
    }   
    
  • 相关阅读:
    3、Less-计算
    2、Less-混合
    1、Less-初见
    5、反射-动态代理
    4、反射-类的构造器:Constrctor
    3、反射-Field
    2、反射-Method&父类
    1、反射-Class&ClassLoader
    5、URLConnection(3)
    Linux进程状态查询
  • 原文地址:https://www.cnblogs.com/zk47/p/5758929.html
Copyright © 2011-2022 走看看