error message

This is a discussion on error message within the C Programming forums, part of the General Programming Boards category; I am looking to solve the error of "c++ forbids implicit conversion from 'void *' in assignment". Here is my ...

  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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,535
    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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21