int main(){ int a = 5; int b = 0; printf("b: %i", b); AddOne(b); printf("b: %i", b); }
void Log (const char *s) { int i,j; char split[1024]; for (i=0,j=0; s[i]!=0; i++) { if (s[i]=='\n') { split[j]=0; // end of line if (split[0]==0) { split[0]=' '; split[1]=0; } AddOne(split); j=0; } else { split[j++]=s[i]; } } split[j]=0; AddOne(split); }
void Log (const char *s) { int i,j; u32 length = xr_strlen( s ); #ifndef _EDITOR PSTR split = (PSTR)_alloca( (length + 1) * sizeof(char) ); #else PSTR split = (PSTR)alloca( (length + 1) * sizeof(char) ); #endif for (i=0,j=0; s[i]!=0; i++) { if (s[i]=='\n') { split[j]=0; // end of line if (split[0]==0) { split[0]=' '; split[1]=0; } AddOne(split); j=0; } else { split[j++]=s[i]; } } split[j]=0; AddOne(split); }
int main(){ // PASS BY REFERENCE // original arguments are modeified in pass by reference // no need to return back anything // because original array is modified to job done int x = 5; std::cout << "x " << x << "\n"; foo(x); std::cout << "after calling foo " << x << "\n"; AddOne(x); std::cout << "should be 7 " << x << "\n"; }
/*--------------------------------------------------------------------- ConstructHull adds the vertices to the hull one at a time. The hull vertices are those in the list marked as onhull. ---------------------------------------------------------------------*/ void ConstructHull( void ) { tVertex v, vnext; v = vertices; do { vnext = v->next; if ( !v->mark ) { v->mark = PROCESSED; AddOne( v ); CleanUp( &vnext ); /* Pass down vnext in case it gets deleted. */ if ( check ) { fprintf(stderr,"ConstructHull: After Add of %d & Cleanup:\n", v->vnum); Checks(); } if ( debug ) PrintOut( v ); } v = vnext; } while ( v != vertices ); }