Recent Changes - Search:

edit SideBar


Firefox 2
Get Thunderbird!

C /

SelfReferentialStructureExample1

Self referential structure �rneği.

/** 
 * Program: self_referential_structure.c
 * Aciklama: Icinde kendini gosteren bir structure bulunan structure ornegi.
 * Kaynaklar: 
 * 	1- C How to Program, Deitel
 */


#include <stdio.h>
#include <stdlib.h>
#include <string.h>

main (int argc, char *argv[]) {

	// Dugum(node) bildirimi.
	// Node = Veri(date) + Bag bilgisi(nextPtr)
	struct node {
		int data;
		struct node *nextPtr;
	};

	// Bag bilgisini tutacak pointer i�in bellekten yer alinir.
	struct node *newPtr;
	newPtr = malloc(sizeof(struct node));

	printf("%d \n", sizeof(int) );
	printf("%d \n", sizeof(struct node));


	// Belekten aldigimiz yeri iade edelim ki borclu gitmeyelim
	free(newPtr);

	printf("\n --------------- Biti --------------\n");
	return 0;

} //main() sonu.

Edit - History - Print - Recent Changes - Search
Page last modified on September 03, 2005, at 05:37 PM