Objects in C

When I even look through some tutorials / notes for C, I quite often come across the term “objects”. I was always interested in what the object related to the procedural language does. Going a little deeper, I could understand that something occupying part of the memory is called an “object” in c.

My question is whether I understand correctly or if something is missing. Thank!

+3
source share
3 answers

From the draft C99 standard :

3.14
object
is a data storage area in the runtime whose contents can represent Values

So, you are basically right.

Notes:

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

C, , "" , . , int, long, float, - , malloc'd.

+2

There was this one after some time ago on comp.lang.c, associated with this famous Chris Torek, who can help you.

+2
source

All Articles