Objects in C language

后端 未结 3 1555
名媛妹妹
名媛妹妹 2021-01-14 06:32

Wheneven I go through some tutorials/notes for C, I quite come across the term \"objects\". I was always wondering what does the object got to do with the procedural languag

3条回答
  •  一生所求
    2021-01-14 06:58

    From the draft of the C99 Standard:

    3.14
    object
    region of data storage in the execution environment, the contents of which can represent values

    So, you're basically right.

    Notes:

    • an object can have a name: int object = 42;
    • an object can be a part of a larger object: struct tm x; /* (x) and (x.tm_year) are objects */
    • an object can be allocated dinamycally: int *arr = malloc(42); if (arr) /* arr[4] is an object */;

提交回复
热议问题