This is a code I've written for Random Directed Acyclic Graph Generation:

Code:
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <time.h>


using namespace std;


int random_or_user_defined( void );
int random_weight_generation( int, int );
int randvert ( void );
int fixedvert ( void );
int random_edge_generation( int );
int connflagcheck( int, int, int );
int vnum, **edge, *connflag, **weight;


int main( void )
{
    random_or_user_defined();
    
    srand (time(NULL));


    random_edge_generation( vnum );


    random_weight_generation( vnum, **edge );


    return 0;


}


int random_or_user_defined( void )
{
    char opt;
    
    cout<<"Do you want to manually enter the number of vertices?";
    cout<<endl<<"Press Y for yes, N for no."<<endl;
    cin>>opt;


    while (( opt != 'Y' ) && ( opt != 'y' ) && ( opt != 'N' ) && ( opt != 'n' ))
    {
        cout<<"Wrong input! Try again: ";
        cin>>opt;
    }


    if (( opt == 'Y' ) || ( opt == 'y'))
    {
        randvert( );
    }
    else if (( opt == 'N' ) || ( opt == 'n' ))
    {
        fixedvert( );
    }    
    
    return vnum;


}




int randvert ( void )
{
    int vnum_max;


    cout<<"Enter the number of maximum vertices: ";
    cin>>vnum_max;
    
    while (vnum_max < 2)
    {    
        cout<<"A graph with one vertex is inadmissible."<<endl<<"Enter a number greater than 1. ";
        cin>>vnum_max;
    }


    srand (time(NULL));
    vnum = (rand()%vnum_max) + 1;
    
    cout<<"Number of vertices chosen: "<<vnum;
    
    return vnum;
}


int fixedvert ( void )
{
    cout<<"Enter the number of vertices: ";
    cin>>vnum;
    
    return vnum;
}


int random_edge_generation( int vnum )
{
    int i, j, k, **edge;


    edge = (int **) malloc ( vnum * sizeof (int* ) );
        
    for(i = 0; i < vnum; i++)
    {
        edge[i] = (int *) malloc ( vnum * sizeof (int) );        
    }


    connflag = (int *) malloc ( vnum * sizeof (int) );
    
    for ( i = 0; i < vnum; i++ )
    {
        connflag[i] = 0;
        
        for ( j = 0; j < vnum; j++ )


            edge[i][j] = 0;
    }


    
    for ( i = 0; i < vnum; i++ )
    {
        for ( j = vnum - 1; j > i; j-- )
        {
            if (rand()%2 == 1)
            {
                edge[i][j] = 1;
                connflag[j] = 1;
            }


        }
    }


    connflagcheck( *connflag, **edge, vnum );


    return 0;
}


int connflagcheck( int *connflag, int **edge, int vnum )
{
    int i;
    char opt;


    cout<<"Will you allow disconnected graph? Press Y or N: ";
    cin>>opt;
    
    while (( opt != 'Y')&&( opt != 'y' )&&( opt != 'N' )&&( opt != 'n' ))
    {
        cout<<"Wrong input! Try again: ";
        cin>>opt;
    }
    if (( opt == 'N' ) || ( opt == 'n' ))
    {
    
        for ( i = 1; i < vnum; i++ )
        {
            if ( connflag[i] == 0 )
            {
                edge[rand()%i][i] = 1;
            }
        }
    }


    return **edge;
}


int random_weight_generation( int vnum, int **edge )
{
    int i, j, wmax;


    cout<<"Enter the maximum weight: ";
    cin>>wmax;


    weight = (int **) malloc ( vnum * sizeof (int *) );
        
    for(i = 0; i < vnum; i++)
    {
        weight[i] = (int *) malloc ( vnum * sizeof (int) );        
    }


    for ( i = 0; i < vnum; i++ )
    {
        for ( j = vnum - 1; j > i; j-- )
        {
            if ( edge[i][j] == 1 )
            {
                weight[i][j] = (rand() % wmax) + 1;
            }


        }
    }


    return **weight;
}
However this gives two LNK2019 error codes. I'm new to coding, so can anyone help me out? I'd like to learn what I'm doing wrong.