Archives


- Beowulf
- Beowulf Announce
- Scyld-users
- Beowulf on Debian

[Beowulf] Re: A start in Parallel Programming?

Many of your questions may have already been answered in earlier discussions or in the FAQ. The search results page will indicate current discussions as well as past list serves, articles, and papers.

Search

Peter St. John peter.st.john at gmail.com
Wed Mar 14 08:43:46 PDT 2007


Skipped content of type multipart/alternative-------------- next part --------------
#include <stdio.h>

#define NFUNCS 2

int add1(int n);
int add2(int n);



int main(int argc, char **argv)
{
	//printf("The entry point of \"printf\" is %0x\n", printf);

	char c;

	int (*funcTab[NFUNCS])(int);

	funcTab[0] = (add1);
	funcTab[1] = (add2);

	printf("Would you like to add 1 or 2? (1, 2, q, Q): ");
	c = getchar();
	putchar(getchar());
	if(c < '1' || c > '2')
	{
		printf("Exiting.\n");
		return 0;
	}
	printf("The value of 10 incremented is %d\n", ((funcTab[c-'1'])(10)));

	return 0;

}
int add1(int n)
{
	return n+1;
}
int add2(int n)
{
	return n+2;
}


More information about the Beowulf mailing list