Creative Commons License Foxbond's Repo

/** (c) 2015 Michał (Foxbond) Chraniuk */
#include <stdio.h>
#include <math.h>

typedef struct elem {
				int r;
				float ob;
				struct elem* next;
}elem;

int main (){
		
		int i,j;
		elem* lista=NULL;
		
		for (i=1;i<11;i++){
				elem* buf = (elem*)malloc(sizeof(elem));
				buf->r=i;
				buf->ob=(float)2*M_PI*i;
				buf->next = NULL;
				if (lista == NULL){
					 lista = buf;
					 continue;
			  }
			  elem* pointer = lista;
			  for (;;){
						if (pointer->next == NULL){
							 pointer->next = buf;
							 break;
					  }
					  pointer = pointer->next;
				}
		}
		
		
		if (lista == NULL){
			 printf("Pusta lista!");
	  }else{
			 elem* pointer = lista;
			 for(;;){
			 		printf("r = %d \t ob = %f\n", pointer->r, pointer->ob);
					 if (pointer->next == NULL) break;
					 pointer = pointer->next; 
			 }		
		}
		
		
		getch();
		return 0;
}

> Back