memory structure in C and value of EOF

M

Migrators

1)How is the memory structure organised in C. i.e., the way in which
the stack and heap memory are used in C.

2) What will be the value of EOF.
 
J

Joona I Palaste

Migrators said:
1)How is the memory structure organised in C. i.e., the way in which
the stack and heap memory are used in C.

Depends entirely on the implementation.
2) What will be the value of EOF.

A negative integer value.
 
E

Emmanuel Delahaye

In said:
1)How is the memory structure organised in C. i.e., the way in which
the stack and heap memory are used in C.

The C language doesn't define stack nor heap. The local variables belong to
the automatic memory. The allocated variables belong to the allocated memory.
The way they are managed on your platform is beyond the C-language
definition. It's an implementation issue, and you don't need these details to
write standard C programs. If you insist, the details are in your compiler
manual.
2) What will be the value of EOF.

It's EOF. (a negative int). Actually, you don't need to know the binary
value. If you insist, the value is defined in <stdio.h>.
 
G

Gordon Burditt

1)How is the memory structure organised in C. i.e., the way in which
the stack and heap memory are used in C.

Chances are it WON'T be organized by the AFL-CIO. But ANSI C does
not rule out that possibility.

What type of answer did you expect? Alphabetically by Social
Security Number? There's a Presidential Structure, and under that
are the vice-structures, and under that there are the assistant
vice-structures and manager-structures, ... and under that there
are the janitor-structures? That the list of allocated memory is
kept in a SQL database in sub-dungeon in the basement of Microsoft
corporate headquarters, and you'll be taxed on every piece of memory
you use? I believe all of these are allowed by ANSI C, but they
are rather unlikely implementations.

ANSI C doesn't make requirements on HOW you have to implement this
stuff, just that it needs to work as required.
2) What will be the value of EOF.

The value of EOF is EOF, a negative integer. Contrary to popular
opinion, its value is NOT guaranteed to be -42.

Gordon L. Burditt
 
M

Malcolm

Gordon Burditt said:
That the list of allocated memory is kept in a SQL database in sub-
dungeon in the basement of Microsoft corporate headquarters, and
you'll be taxed on every piece of memory you use? I believe all of
these are allowed by ANSI C, but they are rather unlikely
implementations.
I don't see what is unlikely about this. Presumably you will be charged for
each byte when allocated, and also for each read or write. 1s will be
charged at a higher rate than 0s, because of extra electricity used.
 
G

Gordon Burditt

That the list of allocated memory is kept in a SQL database in sub-
I don't see what is unlikely about this. Presumably you will be charged for
each byte when allocated, and also for each read or write. 1s will be
charged at a higher rate than 0s, because of extra electricity used.

Microsoft corporate headquarters is already full of copies of every
computer document you ever created (all versions) and every keystroke
you ever made. The archive goes all the way down to Hell, and fills
it. There's no *ROOM* for a database of allocated memory in the
corporate headquarters. The real database is kept in the headquarters
of its wholly-owned subsidiary, the IRS.

Microsoft charges not only for allocating the memory, but for how
long you use it, in spite of the fact that it's YOUR memory that
YOU paid for. This is one reason why Windows has so many memory
leaks - it's a revenue-enhancing feature.

Gordon L. Burditt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top