473,386 Members | 1,830 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,386 software developers and data experts.

How to get void insertnameoffunction() to match insertnameoffunction() in int main()

4
The two lines are:

void success(const void *sum1, const void *sum2, const void *sum3, const void *sum4, const void *sum5)

and in int main():
success(sum1, sum2, sum3, sum4, sum5)

What do I need to change in the int main() portion to get them to match? Currently it brings up an error saying that
all the sums are undeclared (first use in this function) in the success(sum1, sum2, sum3, sum4, sum5) line, but doesn't show the void line to be incorrect.
Dec 1 '13 #1
2 1105
weaknessforcats
9,208 Expert Mod 8TB
First, there are no variables in main you can use to make the function call to success.

Second, the success function arguments are const pointers to void. Why do that? void means no type. A void pointer can't be used until it is converted to a type so the success function must already know, somehow, what the type is. And if that is true, why not just use the type?

Third, even though the void line shows no errors, after you define variables in main, you will start to get errors because of my second point above.
Dec 1 '13 #2
donbock
2,426 Expert 2GB
When you call success() from within main, where do you expect the sum1 to sum5 variables to come from? That is, how and where are they defined?
Dec 2 '13 #3

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

Similar topics

89
by: Sweety | last post by:
hi, Is main function address is 657. its show in all compiler. try it & say why? bye,
16
by: Peter Ammon | last post by:
Often times, I'll have some malloc()'d data in a struct that need not change throughout the lifetime of the instance of the struct. Therefore, the field within the struct is declared a pointer to...
10
by: Merrill & Michele | last post by:
The following progs differ only in the location of the prototype (<--adjective) definition with respect to the main call. Both build and behave for me. Is there a difference that amounts to...
6
by: rouble | last post by:
Hi All, Is it safe to store a uchar in a void* and then extract the uchar value out of it again ? My understanding is that the size of a void* should always be equal to or greater than the...
6
by: gamehack | last post by:
Hello all, I've thought about having to implement 2 functions, say enter_main_loop(func_name); and a function called quit_application(); which terminates the program. The enter_main_loop() can...
7
by: ballpointpenthief | last post by:
Hello, I'm thinking that it would be a good idea to start using the return code for main() to return the amount of memory still allocated (which would hopefully be zero) to ensure all memory has...
12
by: Bill Pursell | last post by:
The following code generates a compiler warning when compiled with gcc -pedantic: typedef (*FUNC)(int); FUNC f; void * get_f(void) { return &f;
25
by: Christian Christmann | last post by:
Hi, the ANSI-C 99 standard specifies that the main function has "int" as return type. However, there are still lots of people declaring "void" as main return type. Did previous ANSI-C...
9
by: George2 | last post by:
Hello everyone, What is wrong with the code, I just want to allocate an array of 100 void* pointers. :-) int main() { void** p;
0
by: =?windows-1252?Q?Sch=FCle_Daniel?= | last post by:
Hi, $ cat main.cpp #include <iostream> //#define VOID void typedef void VOID; VOID foo() { std::cout << "in foo" << std::endl;
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.