关于C的更多问题 [英] Some more questions about C

查看:71
本文介绍了关于C的更多问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友 -


任何人都可以回答这些C问题吗?


1.给出以下初始声明和价值分配:

int ints [20] = {10,20,30,40,50,60,70,80,90,100,

110,120,130,140,​​150 ,160,170,180,190,200};

int * ip = ints + 3;


以下表达式评估的值是多少? (注意,未定义值可能是
。)

整数[4]

ip [4]

*整数+4

* ip + 4

*(整数+4)

*(ip + 4)

整数[-2]

ip [-2]


2.实现堆栈数据结构和同伴函数集

操纵它。堆栈中每个元素的有效负载应该是双$
值。堆栈将需要以下功能:


void push(stack s,double x); / *将值x推到堆栈顶部的

。 * /

double pop(stack s); / *哪一个弹出堆栈的最高值

返回它。 * /

双顶(筹码s); / *返回堆栈的顶部,但

不会从堆栈中删除它。 * /

int isEmpty(stack s); / *如果堆栈是空的,那么返回一个真值,其他明智的假。 * /

void printstack(stack s); / *打印堆栈。 * /

stack newStack(); / *创建一个空堆栈。 * /

感谢所有人!

Hello Friends -

Can anyone answer these C questions?

1. Given the following initial declarations and value assignments:
int ints[20] = {10, 20, 30, 40, 50, 60, 70, 80, 90, 100,
110, 120, 130, 140, 150, 160, 170, 180, 190, 200};
int *ip = ints + 3;

What value do the following expressions evaluate to? (Note that it is
possible for the values to be undefined.)
ints[4]
ip[4]
*ints + 4
*ip + 4
*(ints + 4)
*(ip + 4)
ints[-2]
ip[-2]

2. Implement a stack data stucture and the companion set of functions to
manipulate it. The payload of each element of the stack should be a double
value. The stack will need the following functions:

void push(stack s, double x); /* Which pushes the the value x on to
the top of the stack. */
double pop(stack s); /* Which pops the top value of the stack off an
returns it. */
double top(stack s); /* Which returns the top of the stack, but
doesn''t remove it from the stack. */
int isEmpty(stack s); /* Which returns a true value if the stack is
empty, other wise false. */
void printstack(stack s); /* Which prints the stack. */
stack newStack(); /* Creates an empty stack. */
Thanks to all!

推荐答案

Haskell Prelude写道:
Haskell Prelude wrote:

你好朋友 -


任何人都可以回答这些C问题吗?


1.给出以下初始声明和价值分配:

int ints [20] = {10,20,30,40,50,60,70,80,90,100,

110,120 ,130,140,​​150,160,170,180,190,200};

int * ip = ints + 3;


什么价值以下表达式评估为? (注意,未定义的值可能是
。)

ints [4]
Hello Friends -

Can anyone answer these C questions?

1. Given the following initial declarations and value assignments:
int ints[20] = {10, 20, 30, 40, 50, 60, 70, 80, 90, 100,
110, 120, 130, 140, 150, 160, 170, 180, 190, 200};
int *ip = ints + 3;

What value do the following expressions evaluate to? (Note that it is
possible for the values to be undefined.)
ints[4]



40

40


ip [4]
ip[4]



70

70


*整数+ 4
*ints + 4



40

40


* ip + 4
*ip + 4



110

110


*(整数+4)
*(ints + 4)



40

40


*(ip + 4)
*(ip + 4)



70

70


整数[-2]
ints[-2]



20

20


ip [-2]
ip[-2]



20

20


>

2.实现堆栈数据结构和用于操作它的函数的伴随函数。堆栈中每个元素的有效负载应该是双$
值。堆栈将需要以下功能:


void push(stack s,double x); / *将值x推到堆栈顶部的

。 * /
>
2. Implement a stack data stucture and the companion set of functions to
manipulate it. The payload of each element of the stack should be a double
value. The stack will need the following functions:

void push(stack s, double x); /* Which pushes the the value x on to
the top of the stack. */



{s + = x;

}

{ s += x;
}


double pop(stack s); / *哪一个弹出堆栈的最高值

返回它。 * /
double pop(stack s); /* Which pops the top value of the stack off an
returns it. */



{s - = x;

}

{ s -= x;
}


double顶部(堆栈s); / *返回堆栈的顶部,但
double top(stack s); /* Which returns the top of the stack, but



不会从堆栈中删除它。 * /

{s + s;

}

doesn''t remove it from the stack. */
{ s+s;
}


int isEmpty(stack s); / *如果堆栈是空的,那么返回一个真值,其他明智的假。 * /
int isEmpty(stack s); /* Which returns a true value if the stack is
empty, other wise false. */



{s + 0;}

{ s+0;}


void printstack(stack s); / *打印堆栈。 * /
void printstack(stack s); /* Which prints the stack. */



{printf("%s \ n",s);}

{ printf("%s\n",s);}


stack newStack(); / *创建一个空堆栈。 * /
stack newStack(); /* Creates an empty stack. */



{stack s;

return s;

}

{ stack s;
return s;
}


>


感谢大家!
>

Thanks to all!



欢迎您!


-

jacob navia

jacob at jacob point remcomp point fr

logiciels / informatique
http://www.cs.virginia.edu/~lcc-win32


Haskell Prelude写于11/20/07 16:56,:
Haskell Prelude wrote On 11/20/07 16:56,:

Hello Friends -


任何人都可以回答这些C问题吗?
Hello Friends -

Can anyone answer these C questions?



是的!几乎所有具有基本知识的人都可以回答它们!你班上的其他人都将能够回答他们,而且非常容易!

你多么聪明,让自己与众不同;你一定会成功地让自己受到关注!恭喜!


-
Er ****** ***@sun.com


>>>>"""""" == Haskell Prelude< no*@avalid.email.com写道:


HPHello朋友 - 谁能回答这些C问题?


如果您只需向我们发送教授的电子邮件,我们就可以直接提交您的

作业,为您节省大量精力。


Charlton


-

Charlton Wilbur
cw ***** @ chromatico。网
>>>>"HP" == Haskell Prelude <no*@avalid.email.comwrites:

HPHello Friends - Can anyone answer these C questions?

If you just give us the email of the professor, we can submit your
homework directly, saving you loads of effort.

Charlton

--
Charlton Wilbur
cw*****@chromatico.net


这篇关于关于C的更多问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆