예제 #1
0
int main()
{
	long number;
	number = NUMBER;
	
	long num, maxPrime;
	maxPrime = 0;
	num = 1;
	linkedList *primeList;
	primeList = createLinkedList();
	enlist(primeList, 2);
	while (num <= number) {
		if (checkPrime(primeList, num) && num > maxPrime) {
			maxPrime = num;
			printf("%ld\n", maxPrime);
			if (number%maxPrime == 0) {
				number /= maxPrime;
			}
		}
		num += 2;
	}
	
	printf("The largest prime factor is: %ld\n", maxPrime);
	printf("destroying linked list...\n");
	destroyLinkedList(primeList);
	return 0;
}
예제 #2
0
파일: main.c 프로젝트: andyg7/CodePractice
int main(int argc, const char * argv[]) {

	FILE *file = fopen(argv[1], "r");
	char line[1024];
	while(fgets(line, 1024, file)) {
		//printf("%s", line);

	}
	struct node *aList;
	initializeLinkedList(&aList);
	insertBack(9, &aList);
	insertBack(61, &aList);
	insertFront(0, &aList);
	deleteFront(&aList);
	insertFront(109, &aList);
	insertFront(81, &aList);
	insertBack(1890, &aList);
	printf("%s\n", "printing list:");
	printLinkedList(&aList);
	destroyLinkedList(&aList);	
	printf("got %d\n", ant);
	
	fclose(file);
#ifndef _MY_MYTEST_H_
	printf("defining");
#endif
	return 0;
}
예제 #3
0
 static void destroyLinkedList(nodeptr node) {
     if(node == nullptr) {
         return;
     }
     else{
         destroyLinkedList(node->next);
         delete node;
     }
 }
예제 #4
0
 ~LinkedList(){
     destroyLinkedList(head);
 }
예제 #5
0
void extern deinit(lx_light_container_t *lightCollection) {
    destroyLinkedList(lightCollection);
}
예제 #6
0
void extern getActive(lx_light_container_t* lightCollection) {
    destroyLinkedList(lightCollection);
    discover(lightCollection);
    getInfo(lightCollection);
}