Thread: error message

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    12

    error message

    I am looking to solve the error of "c++ forbids implicit conversion from 'void *' in assignment". Here is my declarations and below is the section of code that is effected.


    #include <stdio.h>
    #include <stdlib.h>
    #define NULL 0

    struct node
    {
    int number;
    struct node *next;
    };

    struct node *pageFaults, *p, *q, *z, *n;
    int num=0;
    void ChangeFrames(void)
    {
    int count, x, y, r, m, tempx, frames[10], pages[40];
    count=0;

    This section here needs a cast ...I think


    if (num==10)
    {
    pageFaults = calloc(1, sizeof(struct node)); /* this is my problem section I need a cast for *?
    (*pageFaults).number=frames[0];
    (*pageFaults).next=NULL;
    q=pageFaults;
    }

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Because you're writing C, and using a C++ compiler to compile it

    Decide which language you want to use (c/c++ isn't a language - it's a botch), then read this
    http://www.cprogramming.com/cboard/s...threadid=11694

    One more thing
    #define NULL 0
    Don't do this - it's perfectly well defined in the system header files.

Popular pages Recent additions subscribe to a feed