By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,961 Members | 1,333 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,961 IT Pros & Developers. It's quick & easy.

C4047 warning (passing/return addresses)

P: 4
Hello

got two warning when compiling , the .exe file works fine with these warning but i prefer to get rid of them :) if anyone can point me to a general website for indirection warnings that would be nice because i don't know anything about them or a fix with a simple explanation


Thanks
Sam

USAGE
*Code to calculate boolean product of two unknown square matrix sizes

WARNINGS:
boolean.c(13) : warning C4047: '=' : 'int *' differs in levels of indirection fr
om 'int'
boolean.c(46) : warning C4047: 'return' : 'int' differs in levels of indirection
from 'int *'

CODE(part of it)
Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. //PROTOTYPES
  4. int boolean_mproduct(int *xptr , int *yptr , int s); 
  5.  
  6.  
  7.  
  8. //MAIN
  9. void main(void)
  10. {
  11. ........................
  12. ........................
  13. int *zptr;
  14. zptr = boolean_mproduct(&x[0][0],&y[0][0],s); //line 13
  15. .......................
  16. }
  17.  
  18.  
  19.  
  20. //FUNCTION
  21. int boolean_mproduct(int *xptr , int *yptr , int s)
  22.  
  23. {
  24. int *zptr;
  25. zptr = (int *)malloc(s*s*sizeof(int));
  26. .......................................
  27. .......................................
  28. return zptr; //line 46
  29. }
  30.  
Aug 8 '07 #1
Share this Question
Share on Google+
4 Replies


Expert 10K+
P: 11,448
I'm afraid you dotted out the lines that caused the warning message. What's left
to view makes sense though.

kind regards,

Jos
Aug 8 '07 #2

P: 4
oh sorry for the dotted parts , was just following posting guidelines :(
i will PM the full code or send in any other way you prefer to anyone willing to help

Thanks
Sam
Aug 8 '07 #3

weaknessforcats
Expert Mod 5K+
P: 9,197
Your error is here:

int boolean_mproduct(int *xptr , int *yptr , int s)

{
int *zptr;
zptr = (int *)malloc(s*s*sizeof(int));
.......................................
.......................................
return zptr; //line 46
}
The function boolean_mproduct() returns an int but you are returning an int*. I'm surpsrised your compiler lets this go by with a warning. This type of error should stop the build.
Aug 8 '07 #4

P: 4
Your error is here:



The function boolean_mproduct() returns an int but you are returning an int*. I'm surpsrised your compiler lets this go by with a warning. This type of error should stop the build.
yea , it was just a warning

using
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.42 for 80x86
included in Microsoft Visual C++ 2005 Express edition


Thanks a lot , worked
Aug 8 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.