[ create a new paste ] login | about

Link: http://codepad.org/mp7McpnT    [ raw code | output | fork ]

C, pasted on Oct 31:
/* 問 次の空欄(_____)を埋めよ */

#include <stdio.h>
#define STRMAX 100          /* 文字列の要素数 */

int main(void)
{
    char string[STRMAX];
    char _____ = string;          /* ポインタ変数ptを定義と同時に初期化 */
 
    printf("Input string");
    fgets(string, STRMAX, stdin);

    /* 文字列の終わりまで処理を繰り返す */
    while( *pt != _____ ){
        printf("%c", _____ );          /* 1文字出力する */

        if(*pt == ' '){
            /* 他の空白がなくなるまでポインタを進める */
            while( *pt==' ' ){
                pt++;
        }else{
            /* 空白以外:ポインタを一つ進める */
            pt++;
        }
    }

    return 0;
}


Output:
1
2
3
4
5
6
7
In function 'main':
Line 9: warning: initialization makes integer from pointer without a cast
Line 15: error: 'pt' undeclared (first use in this function)
Line 15: error: (Each undeclared identifier is reported only once
Line 15: error: for each function it appears in.)
Line 22: error: expected expression before 'else'
Line 29: error: expected declaration or statement at end of input


Create a new paste based on this one


Comments: