F
fctk
ok, i'm trying to understand the concept of "object" in C.
i know that an object is a region of memory that can represent values.
first: what is meant with "memory"? RAM only? for example, is a register
variable an object (it is in the CPU)? and a file (it is on the HD)?
what about strings such as "hello"? i think they are two distinct
objects: an array of chars, and a pointer to its first element.
so, summarizing, all of the following things are objects:
* arithmetic variables (int a = 0; double pi = 3.1415; ...)
* pointers (char *sPtr; ...)
* arrays (int array[10]; ...)
* array elements (array[0], ...)
* structs
* structs members
* dynamically allocated things (malloc)
* arithmetic constants (2.71, 50000UL, 'A', ...)
* const things (const int x; ...)
would you add some other relevant things in the previous list (or remove
some)?
i know that an object is a region of memory that can represent values.
first: what is meant with "memory"? RAM only? for example, is a register
variable an object (it is in the CPU)? and a file (it is on the HD)?
what about strings such as "hello"? i think they are two distinct
objects: an array of chars, and a pointer to its first element.
so, summarizing, all of the following things are objects:
* arithmetic variables (int a = 0; double pi = 3.1415; ...)
* pointers (char *sPtr; ...)
* arrays (int array[10]; ...)
* array elements (array[0], ...)
* structs
* structs members
* dynamically allocated things (malloc)
* arithmetic constants (2.71, 50000UL, 'A', ...)
* const things (const int x; ...)
would you add some other relevant things in the previous list (or remove
some)?