| 
        
         C / 
          SelfReferentialStructureExample1Self 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.
 |