Re: for and arrays




"Mark L Pappin" <mlp@xxxxxxx> wrote in message
news:87bq0odu4m.fsf@xxxxxxxxxxxxxxxxxxx

[snip]

1. Copy and paste this code (between "/*begin1*/" and "/*end1*/") into
a new source file, compile, and run it. What output does it produce?

/*begin1*/
#include <stdio.h>
int main(void){
/* you are not expected to understand this - it is to
verify that you can and will follow instructions */
printf("%s%c%d\n",
"protest"+3,
"blank space"[5],
27/3-2*2*2);
return 0;
}
/*end1*/


2. Write a program to print a single line containing the greeting
"Hello, world!" followed by a newline character.

The results I got from your first program was a warning concerning no
newline character and the text

test 1

Here is the answer to #2 of your question.

#include <stdio.h>

int main(void) {
printf("hello world\n");
return 0;
}

Do you wish to correspond through private email ? I will post the answer to
your third question later.

Bill


.



Relevant Pages

  • Re: fpurge/fflush
    ... if you dont mind to explain: ... then loops through the stream until it gets either EOF or a newline character. ... values get promoted straight back to int anyway. ...
    (comp.lang.c)
  • Re: fpurge/fflush
    ... then loops through the stream until it gets either EOF or a newline character. ... The casts to (char) are useless; ... values get promoted straight back to int anyway. ...
    (comp.lang.c)
  • K&R2 ex 1-8
    ... whose simple request is to write a program that counts blanks, tabs and ... int main ... newline character. ...
    (comp.lang.c)
  • Re: K&R2 ex 1-8
    ... > whose simple request is to write a program that counts blanks, ... void retrun (int); ... > newline character. ... I took this as a request for code review. ...
    (comp.lang.c)
  • Re: Logic C++ error. Why?
    ... In article, Alwyn ... >I thought the OP's first program was just perfect; ... >monstrosity that is supposed to do the same thing. ... int operator ...
    (alt.comp.lang.learn.c-cpp)