c++ help (new to programming)

T

t3hseen

what the values of the following expressions: if illegal or unpredictable
please state so.

stat char *arrax ="C is my favourite";
stat char *lp=arrax;
static int five=5;

a)*(arrax + 8)
b)*arrax+2
c)lp[10]
d)12[arrax\
 
H

Howard

t3hseen said:
what the values of the following expressions: if illegal or unpredictable
please state so.

stat char *arrax ="C is my favourite";
stat char *lp=arrax;
static int five=5;

a)*(arrax + 8)
b)*arrax+2
c)lp[10]
d)12[arrax\

Homework?
 
T

Thomas Matthews

t3hseen said:
what the values of the following expressions: if illegal or unpredictable
please state so.

stat char *arrax ="C is my favourite";
Undefined symbol "stat". Thus illegal.
stat char *lp=arrax;
Undefined symbol, "stat". Thus illegal.
Symbol "arrax" is undefined.
static int five=5;
Valid.
But why is everything static? Hmmmm.
Actually, the "static" has nothing to
do with legality or predictability of
the next expressions.
a)*(arrax + 8)
Undefined symbol "arrax", due to syntax
error.
See also arrax[8].
b)*arrax+2
Undefined symbol "arrax", due to syntax
error.
See also arrax[0] + 2.
Undefined symbol "lp", due to syntax
error.
Since lp == arrax, expression is the
same as arrax[10].
d)12[arrax\
"Unexpected end of file encountered",
due to '\' at end of line.

This one, and the others, are in a C
and C++ textbook as well as the FAQ.
See below.


--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.comeaucomputing.com/learn/faq/
Other sites:
http://www.josuttis.com -- C++ STL Library book
http://www.sgi.com/tech/stl -- Standard Template Library
 
D

David White


As you can see from the responses, you were doomed once you decided to be
honest.

BTW, people are far more inclined to help if you try to answer the questions
yourself and post the work you've done.

DW
 
T

t3hseen

guys, thanks for the help you have provided, i apologize if you thought i
was trying to GET you to do my hw, for i did not know to post what i
thought it was as well,

more importantly i appreciate the links to the tutorials, faq sections
 

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
474,202
Messages
2,571,057
Members
47,661
Latest member
FloridaHan

Latest Threads

Top