Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- struct El{
- int info;
- struct El *next;
- };
- typedef struct El ElementoLista;
- void add_head(ElementoLista **list, int n){
- ElementoLista *new= malloc(sizeof(ElementoLista));
- new->info=n;
- new->next=*list;
- *list=new;
- }
- void cancRec(ElementoLista **list, int v){
- ElementoLista *prec= NULL;
- ElementoLista *corr= *list;
- if(corr != NULL){
- if(corr->info%v==0){
- if(prec==NULL){
- *list=*list->next;
- } else {
- prec=
- }
- cancRec(&list, v);
- }
- }
- /*int RecLenght(ElementoLista *list){
- int c;
- if(list == NULL){
- c=0;
- } else {
- c=1+RecLenght(list->next);
- }
- return c;
- }*/
- /void RecStampa(ElementoLista *list){
- if(list == NULL){
- printf("NULL");
- } else {
- printf("%d -> ", list->info);
- RecStampa(list->next);
- }
- }
- int main(void) {
- ElementoLista *list= NULL;
- int n, v;
- scanf("%d", &n);
- scanf("%d", &n);
- while(n>=0){
- add_head(&list, n);
- scanf("%d", &n);
- }
- cancRec(&list, v);
- //printf("%d", RecLenght(list));
- RecStampa(list);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement