Mralko99

scl_function

Apr 15th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.75 KB | None | 0 0
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include "scl_functions.h"
  4.  
  5. float SCL_sum(TipoNodoSCL* head_ptr){
  6.   if (head_ptr!=NULL)
  7.     return SCL_sum(head_ptr->next)+head_ptr->value;
  8.   else
  9.         return 0;
  10. }
  11.  
  12. void SCL_integral_aux(TipoNodoSCL* head_ptr, float sum_till_now) {
  13.   int temp=head_ptr->value;
  14.   head_ptr->value=sum_till_now;
  15.   sum_till_now+=temp;
  16.   if (head_ptr->next!=NULL)
  17.     SCL_integral_aux(head_ptr->next,sum_till_now);
  18. }
  19.  
  20. void SCL_integral(TipoNodoSCL* head_ptr){
  21.   SCL_integral_aux(head_ptr->next,head_ptr->value);
  22. }
  23.  
  24. float SCL_dot(TipoNodoSCL* head1_ptr, TipoNodoSCL* head2_ptr) {
  25.   if (head1_ptr!=NULL&&head2_ptr)
  26.     return SCL_dot(head1_ptr->next,head2_ptr->next)+head1_ptr->value*head2_ptr->value;
  27.   else
  28.         return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment