Ejemplo n.º 1
0
/* Time measurement function for an empty function call.
   returns time in nano-seconds upon success,
   and -1 upon failure.
   Zero iterations number is invalid.
   */
double osm_function_time(unsigned int osm_iterations)
{
	if(osm_iterations <= 0)
	{
		osm_iterations = OSM_DEFAULT_ITER;
	}
	timeval before, after, diff;  // Time stamps
	timezone defalutTimeZone;  // TimeZone
	int remaining = osm_iterations % LP_UNRLNG ? 1 : 0;
	if(gettimeofday(&before,&defalutTimeZone) == FAILURE)
	{
		return FAILURE;
	}
	for(unsigned int i = 0; i < osm_iterations / LP_UNRLNG + remaining; ++i)
	{
		someFunction();
		someFunction();
		someFunction();
		someFunction();
		someFunction();
	}
	if(gettimeofday(&after,&defalutTimeZone) == FAILURE)
	{
		return FAILURE;
	}
	timersub(&after,&before,&diff);
	return (double) ((diff.tv_sec * pow(10,9)) + (diff.tv_usec * pow(10,3))) / osm_iterations;
}
Ejemplo n.º 2
0
int main(void) {
  int x = 2;
  int a = someFunction(x,3);
  printf("a = %d\n", a);
  printf("x = %d\n", x);
  int b = someFunction(3,x);
  printf("b = %d\n", b);
  printf("x = %d\n", x);
  return EXIT_SUCCESS;
}
Ejemplo n.º 3
0
int main(int argc, char *argv[])
{
	printf("aGlobalInt before someFunction: %d\n", aGlobalInt);
	someFunction();

	printf("aGlobalInt after someFunction: %d\n", aGlobalInt);
	someFunction();

	aGlobalInt = 23;
	someFunction();

	return 0;
}
Ejemplo n.º 4
0
int main(void) {
	/*
	 * By value Ð argument VALUES are copied
	 * into the function parameters
	 */

	printf("--- By Value ---\n");
	int x = 0;
	int y = 0;

	printf("Before function call: x=%d   y=%d\n", x, y);
	someFunction(x,y);
	printf("After function call: x=%d   y=%d\n", x, y);


	/*
	 * By reference Ð argument ADDRESSES are copied
	 * into the function parameters
	 */

	printf("\n--- By Reference ---\n");

	x = 0;
	y = 0;

	printf("Before function call: x=%d   y=%d\n", x, y);
	someOtherFunction(&x,&y);
	printf("After function call: x=%d   y=%d\n", x, y);
	return EXIT_SUCCESS;
}
Ejemplo n.º 5
0
int main(void) {
	int a[SIZE] = { 8,3,1,2,6,0,9,7,4,5 };
	printf("Answer is :\n");
	someFunction(a, 0, SIZE);
	printf("\n");
	return 0;
}
Ejemplo n.º 6
0
/* What does this function do? */
void someFunction( const int b[], int startIndex, int size )
{
   if ( startIndex < size ) {
      someFunction( b, startIndex + 1, size );
      printf( "%d  ", b[ startIndex ] );
   } /* end if */

} /* end function someFunction */
Ejemplo n.º 7
0
int main()
{
	int length = strlen("hey");
	if (someFunction(length) > 1) {
		printf("hello\n");
	}
	return someAFunction(length);
}
Ejemplo n.º 8
0
/* function main begins program execution */
int main( void )
{
   int a[ SIZE ] = { 8, 3, 1, 2, 6, 0, 9, 7, 4, 5 }; /* initialize a */
  
   printf( "Answer is:\n" );
   someFunction( a, 0, SIZE );
   printf( "\n" );

   return 0; /* indicates successful termination */

} /* end main */
Ejemplo n.º 9
0
Archivo: main.cpp Proyecto: CCJY/coliru
int main()
{
	String e;
	someFunction(e);
}
Ejemplo n.º 10
0
void constexprTest(){
	int arr[someFunction() + 3];
}
Ejemplo n.º 11
0
int main()
{
	someFunction();
    return 0;
}