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

    Join Date
    Sep 2003
    Posts
    5
    Rep Power
    0

    compile errors? can u check them?


    Hi, please help.


    I have compile errors

    "assignment makes pointer from integer without a cast"

    for the below code.
    Can anyone tell me how to fix this?
    Thanks in advance.



    void set_paths() {
    char * path;
    char * ch;
    char * chp;
    int i;

    path = getenv("PATH");
    printf("PATH: %s\n", path);

    ch = path;
    i = 1;
    while ( (ch = index(ch, ':')) != NULL) { ++i; ++ch; }
    paths = (char **)malloc( (i+1) * sizeof(char *));
    paths[0] = path;
    ch = chp = path;
    i = 1;
    while ( (ch = index(ch, ':')) != NULL) {
    *ch = 0;
    i ++;
    ch ++;
    paths[i] = chp;
    chp = ch;
    printf("Path %d: %s\n", i, paths[i]);
    }
    paths[i] = 0;
    path_nr = i;
    }
  2. #2
  3. Contributing User

    Join Date
    Aug 2003
    Location
    UK
    Posts
    5,113
    Rep Power
    1803
    1) Post code in code tags to preserve the formatting

    2) Include in the posted code the missing declarations (paths, path_nr, index() )

    3) State or indicate at which line the error is reported.


    Clifford
  4. #3
  5. No Profile Picture
    Dinesh_P_V
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    India
    Posts
    259
    Rep Power
    0

    what is the resutn type of index function ?


    May I know the return type of index function

IMN logo majestic logo threadwatch logo seochat tools logo