hii :)
I've seen alot in (void)func. that at the end of it they put (return;)
why they put it ??what is the logical meaning of it ?? is it the same as (return0;) ??
actually it confused me alot :/
thanks ^_^
shahera.arafat 0 Light Poster
Recommended Answers
Jump to PostIt means "don't return anything". Similar to empty parameter brackets when declaring/calling functions. It can make code easier to read, particularly if you get into the habit of using only one return statement per function.
Jump to Postvoid is no returns but can change input params e.g.
#include <iostream> #include <stdio.h> void myfunc(int &a, int &b, int &c){ a += 1; b -= 2; c = a+b; return; } int main(){ int a=5,b=6,c=7; // print before myfunc() printf("a=%d b=%d c=%d \n", a,b,c); myfunc(a, b, …
All 8 Replies
Lerner 582 Nearly a Posting Maven
AndrisP 193 Posting Pro in Training
deceptikon 1,790 Code Sniper Team Colleague Featured Poster
shahera.arafat commented: void print(node*head,int id){ node*p; p=head; while(p!=NULL){ if(p->id==id){ cout<<p->id; return; } p=p->next; } cout<<"node doesn't exist"; } this (return;)here,for what did they put it ?:/ +0
ddanbe 2,724 Professional Procrastinator Featured Poster
deceptikon 1,790 Code Sniper Team Colleague Featured Poster
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster
L7Sqr 227 Practically a Master Poster
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster
L7Sqr commented: Good points. I agree with more than not but I have to side with CamelCase and if ( foo ) (I like the separation) +9
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.