Friday, 16 April 2010

Example program on Pointer array

#include < stdio.h >

    void PrintErrorMsg(int errorNum);

int main(void) {

        PrintErrorMsg(3);

        return 0;

    } //end main

void PrintErrorMsg(int errorNum) {

        static char * errorList[] = {
            "Cannot open file.\n",
            "Read error.\n",
            "Write error.\n",
            "Media failure.\n"
        };

        printf("%s", errorList[errorNum]);

        return;

    } //end PrintErrorMsg





No comments:

Post a Comment