#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    21
    Rep Power
    0

    Output each character from array!


    Hey guys,

    I had in my last exam this question and my answer was 100% false. Can someone help me?? Thank you...!

    The question was:

    Complete the following segment of code to make it output each character from the start of the declared array(not implemented as a string) up to but excluding any asterik(*) character. The array should be output. Only one while loop containing one putchar() statement may be used.

    d Code:
    #include<stdio.h>
    #define ARRAYSIZE 100
     
    int main(void){
    char array[ARRAYSIZE];
    int index;
    /*assume statements to input the array from the */
    /*user have already been coded and included here */
     
    index = 0;
     
    /*put your code in here*/
    return =0;
     
    }
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,841
    Rep Power
    480
    You probably failed because you didn't replace line 12 with code.

    Please show your work!
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo