问题描述
你好朋友 -
任何人都可以回答这些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!
推荐答案
40
40
70
70
40
40
110
110
40
40
70
70
20
20
20
20
{s + = x;
}
{ s += x;
}
{s - = x;
}
{ s -= x;
}
不会从堆栈中删除它。 * /
{s + s;
}
doesn''t remove it from the stack. */
{ s+s;
}
{s + 0;}
{ s+0;}
{printf("%s \ n",s);}
{ printf("%s\n",s);}
{stack s;
return s;
}
{ stack s;
return s;
}
欢迎您!
-
jacob navia
jacob at jacob point remcomp point fr
logiciels / informatique
是的!几乎所有具有基本知识的人都可以回答它们!你班上的其他人都将能够回答他们,而且非常容易!
你多么聪明,让自己与众不同;你一定会成功地让自己受到关注!恭喜!
-
这篇关于关于C的更多问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!