473,396 Members | 1,965 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Cannot convert 'int**' to 'int*' for argument '1' to 'void shw(int*)' ?

1
Expand|Select|Wrap|Line Numbers
  1. #include<stdio.h>
  2. void disp(int *n);
  3. void shw(int *k);
  4. main()
  5. {   int i;
  6.     int arr[7]={8,2,3,4,5,6,7};
  7.     for(i=0;i<=6;i++)
  8.     {
  9.         disp(&arr[i]);
  10.     }
  11. }
  12. void disp(int *n)
  13. {
  14.     shw(&n);
  15. }
  16. void shw(int **k)
  17. {
  18.     printf("%d",**k);
  19. }
Feb 1 '16 #1
2 6774
weaknessforcats
9,208 Expert Mod 8TB
The function prototype is:

Expand|Select|Wrap|Line Numbers
  1. void shw(int *k);
so &n is an int**.

Never mind the function definition is:

Expand|Select|Wrap|Line Numbers
  1. void shw(int **k)
  2. { etc...
because that's some other function. Unless there's an error in the prototype...
Feb 1 '16 #2
donbock
2,426 Expert 2GB
Function shw appears three times:
  1. Line 3: function prototype.
  2. Line 14: function called.
  3. Line 16: function definition.
The function prototype is inconsistent with the rest; and also with how the function uses its argument on line 18.

I think the prototype is wrong.
Feb 1 '16 #3

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

Similar topics

10
by: Alex Vinokur | last post by:
What is wrong in program below? --- foo.cpp --- struct Foo {}; int main () { Foo foo1, foo2; for (int i = 0, foo1 = foo2; ; ); // Line#5 return 0; }
15
by: Wilfried Mestdagh | last post by:
Hello, probably a beginners question :) I have this code sample in VB: if (objResults.Item(1).etc Translate this into C# if (objResults.etc But compiler complains about the index '1'...
9
by: Igor Okulist | last post by:
int func(void**); { short* p = NULL; func(&p); //<<< here } Could somebody remind me why is this not allowed ? error message: "cannot convert parameter from 'short **' to 'void **'"
4
by: royend | last post by:
Hi. I am having some strange troubles creating a dropdown menu at my toolbar. I have followed this tutorial: http://www.codejock.com/developer/article05.asp My problem occurs at this line:...
2
by: nassim.bouayad.agha | last post by:
Hello, here is a code snippet showning my problem : template<typename _K> class TClass1 { public: void Process(const _K& arg) const {
2
by: munjao1 | last post by:
i am passing an char ** argument and returning its value as int i am getting an error in doing that as cannot convert int to const char* what can i do?
6
by: John | last post by:
The following code: int test = 1; bool isTrue = (bool)test; results in a compiler error: Cannot convert type 'int' to 'bool' wtf, any ideas on how to work around this?
1
by: simbasaurus | last post by:
Is the following code in any way illegal/wrong/dirty? Could it fail to compile on some platforms? void *p; int x,y; x=3; p=(void*)x; p=&y;
2
by: Frostmur | last post by:
Hi !! I'm trying to convert C code to C++. This is my function: static void (*selection)(void) = NULL; static void (*pick)(GLint name) = NULL; void zprSelectionFunc(void (*f)(void))
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.