Re: Urgent C Questions
- From: Jack Klein <jackklein@xxxxxxxxxxx>
- Date: Mon, 14 Jan 2008 21:57:45 -0600
On Tue, 15 Jan 2008 03:41:56 +0100 (CET), Hans Schneider
<hans@xxxxxxxxxxxxxxxxxxxxx> wrote in comp.lang.c:
For it to be a C question, urgent or not, it would have to be about
valid C code.
1. in the prg bellow what vars are stored on stack, heap, data segment?
int i;
void main()
The line above generates undefined behavior, not valid C code.
{
int j;
int *k = (void *)malloc(1);
Since there is no prototype for malloc() in scope, undefined behavior,
not valid C code.
}
(I think j and k are on stack, but where is i?)
2. how to find sizeof variable w/o using sizeof command?
(no clue)
There is no sizeof command, not a valid C question.
3. what is the o/p of this prg?
void main()
The line above generates undefined behavior, not valid C code.
{
int x = 5;
x = x++;
The line above generates undefined behavior, not valid C code.
printf("x=%i", x);
Since there is no prototype for printf() in scope, this causes
undefined behavior, not valid C code.
}
(I think it shoulld be printing 5 but it prints 6!)
I think it should print, "This code was written by an idiot!".
ps: I am using QuickC 2.0
pps: Is very urgent!
Sorry, non of these is a question about the C language. If you are in
an actual C programming course, and your instructor asked these
questions for a homework assignment, do the following:
1. Immediately drop the class.
2. Complain to the school administration about the unqualified
instructor and erroneous material.
--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html
.
- Follow-Ups:
- Re: Urgent C Questions
- From: Hans Schneider
- Re: Urgent C Questions
- From: Chris Hills
- Re: Urgent C Questions
- References:
- Urgent C Questions
- From: Hans Schneider
- Urgent C Questions
- Prev by Date: Re: Urgent C Questions
- Next by Date: Re: Use of Long and Long Long
- Previous by thread: Re: Urgent C Questions
- Next by thread: Re: Urgent C Questions
- Index(es):
Relevant Pages
|
|