nikolas_serafini

Lista 9 - Exercício 1

Aug 23rd, 2013
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.52 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. typedef struct funcType {
  6.     char name[31];
  7.     int mat;
  8.     float salary;
  9. }Func;
  10.  
  11. void salAdjust(Func *worker, float adjust);
  12.  
  13. int main(){
  14.  
  15.     Func *worker;
  16.     worker = (Func *)malloc(sizeof(Func));
  17.     strcpy(worker->name,"test");
  18.     worker->mat = 2013000;
  19.     worker->salary = 1000;
  20.     salAdjust(worker, 310.25);
  21.     printf("Salario ajustado : %f\n",worker->salary);
  22.  
  23.     return 0;
  24. }
  25.  
  26.  
  27. void salAdjust(Func *worker, float adjust){
  28.     Func *p = worker;
  29.     p->salary += adjust;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment