GIDForums  

Go Back   GIDForums > Computer Programming Forums > C Programming Language
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 10-Aug-2004, 04:57
avi avi is offline
New Member
 
Join Date: Aug 2004
Posts: 2
avi is on a distinguished road

error when compiling


the error is :
warning C4047: 'return' : 'int ' differs in levels of indirection from 'int *'

the program is :
CPP / C++ / C Code:
#include <stdio.h>
#include <stdlib.h>

int test(void)

{
int *ptr=NULL;
ptr=calloc (5,sizeof(int));
return ptr;

}


void main (void)
{
int *p=NULL;
p=test();
}
Last edited by dsmith : 10-Aug-2004 at 15:36.
  #2  
Old 10-Aug-2004, 15:39
dsmith's Avatar
dsmith dsmith is offline
Senior Member
 
Join Date: Jan 2004
Location: Utah, USA
Posts: 1,351
dsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of light
Hi avi. This was posted in the wrong forum so I moved it for you.

You are returning an int*, but your function shows a return value of int. Try changing your function as so:

CPP / C++ / C Code:


int* test(void)

{
int *ptr=NULL;
ptr=calloc (5,sizeof(int));
return ptr;

}

  #3  
Old 11-Aug-2004, 03:17
avi avi is offline
New Member
 
Join Date: Aug 2004
Posts: 2
avi is on a distinguished road

thanks allot


it is working now
 
 

Recent GIDBlogMore photos on Flickr by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
kernel compiling & Geforce updating crystalattice Computer Software Forum - Linux 5 16-Jun-2004 07:38
compiling a program within another (C++) Siphiro C++ Forum 5 06-Feb-2004 15:35

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 05:18.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.