Results 1 to 12 of 12

Thread: Function pointers

Threaded View

  1. #1

    Thread Starter
    Frenzied Member aewarnick's Avatar
    Join Date
    Dec 2002
    Posts
    1,037

    Function pointers

    As of yet, I see no use in function pointers. I cannot get it to work. Can anyone figure out why? I am trying to learn how to use them just in case. But just please let me know if they are useless of not.

    #include <iostream>
    #include <cstdlib>
    #include <cstring>
    char funk1(char[], const int, char (*)(char, char));
    char funk2(char[], char);

    int main() {
    const int size=100; int h=2;
    char g[size]="Hi";
    char n[size]={0};

    cin.getline (g, size);
    cin.getline (n, size);
    funk1(g, size, funk2);

    system("PAUSE");
    return 0;
    }

    char funk1(char gg[], const int asize, char (*p)(char, char)) {

    (*p)(char gg[0], char asize);
    }

    char funk2(char x[], char y) {
    if (strlen(x)<8)
    cout<< "xless";
    if (y<8)
    cout<< "yless";
    }
    Last edited by aewarnick; Jan 18th, 2003 at 10:50 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width