Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.51 KB | None | 0 0
  1. //file ClassNumero.h
  2.  
  3. truct ClassNumero{
  4.     int x; //il numero che verrà salvato
  5.  
  6.     void (*times)(int x);
  7. };
  8.  
  9. void time(int x){
  10.     int i;
  11.     for( i = 0; i< x; i++){
  12.         printf("vi voglio bene!\n");
  13.     }
  14. }
  15.  
  16. //file main
  17. #include <stdio.h>
  18. #include <stdlib.h>
  19. #include "ClassNumero.h"
  20. int main(int argc, char*argv[]){
  21.     struct ClassNumero numero;
  22.     char c = *argv[1];
  23.     printf("%c %d\n", *argv[1], c);
  24.     numero.x = c - 48;
  25.     printf("%d\n",numero.x);
  26.     numero.times = time;
  27.         (*numero.times)(numero.x);
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement