C Warning message

Soldato
Joined
1 Mar 2003
Posts
5,508
Location
Cotham, Bristol
I have the following c function that returns a random number between 0 and maxR.

Code:
#include <stdio.h>
char LB_Random(char *maxR,char *dummy)
	{	
	int i;
	static char n[10];
	int rMax = (int)maxR;	
	rMax++;
	srand(time(NULL));
	i = rand() % rMax;
	strcpy(n,(char*)i);
	return n;	
	}

When I compile it it points the return line giving this warning message:

warning C4047: 'return' : 'unsigned char ' differs in levels of indirection from 'unsigned char [10]'

Should I be worried?
 
Thanks :p, although I managed to get around it meself. Only a slight difference in code methinks

Code:
#include <stdlib.h>
#include <string.h>
#include <time.h>
char* LB_Random(char *maxR,char *dummy)
	{	
	int i;
	static char n[10];
	int rMax = atoi(maxR);	
	rMax++;
	i = rand() % rMax;
	sprintf(n,"%d",i);
	return n;	
	}
 
Back
Top Bottom