i'm so confused......when should or must i use void or non void function. and another question one star * and double star **
how t use it ............Thank you very much
i'm so confused......when should or must i use void or non void function. and another question one star * and double star **
how t use it ............Thank you very much
You should use void function, when you don't want to return "anything" from that function.
About your second question 'one star or two':
One 'star' means a Pointer, he points to a place on the memory.
Two 'stars' means a Pointer that points to another pointer.
if you be more specific on your question, we can help you more.
i mean sometimes you still want to use or update the value in non void function but u dont have to return it so this makes me confuse
The function should generally be void if you're never going to want it to return a value. This does not stop the function from working with variables or other program information by way of pointers etc.
Demonographic rhinology is not the only possible outcome, but why take the chance
What value?
A value passed in?
"He who makes a beast of himself, gets rid of the pain of being a man." Dr. Johnson
An example of a function that returns void.
Code:#include <stdio.h> void DumpInt(int); int main() { int j = 10; DumpInt(j); printf ("But in main its %d\n", j); return 0; } void DumpInt(int i) { printf ("Your number is %d\n", i); i += 10; printf ("Your number is now %d\n", i); }
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
>>when should or must i use void or non void function.
You use void when all you want is the side effect
As opposed to wanting a direct changeCode:void display(int num) { printf("The number is %d\n", num); }
Code:int add(int a, int b) { return a + b; }
*Cela*