Witam
36 21 F:\Documents and Settings\Admin\Moje dokumenty\sitkuj.c [Warning] assignment from incompatible pointer type [enabled by default]
to mi wyskakuję po skompilowaniu programu , mogłby mi ktoś powiedzieć czemu i ewentualnie poprawić kod:
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
typedef struct STT{
int key;
struct Lista *next;}ell, *stos;
stos push(int x, stos head){
stos nowy = (stos)malloc(sizeof(ell));
nowy->key=x;
nowy->next=head;
head=nowy;
return head;
}
void wypisz(stos head){
if (head!=NULL){
wypisz(head->next);
printf("%d\n",head->key);
}
}
stos pop(stos head){
stos temp = head->next;
free(head);
return temp;
}
void sitkuj(stos head, int valju, int n){
stos temp = head;
int j = valju;
for(j;j<=n;temp=temp->next, j++) if (j%valju==0) temp->key = 0;
}
int main(){
FILE *plik;
stos head = NULL;
int n;
int i;
int current;
scanf("%d",&n);
if ((plik=fopen("se.txt", "w"))==NULL) {
printf ("Nie moge otworzyc pliku se.txt do zapisu!\n");
getch();
exit(1);
}
for(i=n;i>=2;i--) head = push(i,head); //wypelnienie listy wartosciami od n do 2
for(i=2;i<=n;i++){//czesc glowna prorgamu
current = head->key;
if(current!=0){
fprintf (plik, "%d\n", current);
sitkuj(head, current, n);
}
head = head->next;
}
fclose (plik);
getch();
return 0;
}