Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <ctype.h>
- #include "simlib.h"
- int pulisci(char * vect, int dim){
- if(dim<=0)
- return 0;
- for(int i=0;i<dim;++i)
- vect[i]='\0';
- return 1;
- }
- int riempi(char * vect, int dim, char c){
- if((dim<=0)||(!isalpha(c)))
- return 0;
- int i;
- for(i=0;i<dim-1;++i)
- vect[i]=c;
- vect[i]='\0';
- return 1;
- }
- int trova(char * vect, int dim, char c){
- if((dim<=0)||(!isalpha(c)))
- return 0;
- for(int i=0;i<dim;++i)
- if((vect[i])==c)
- return i+1;
- return -1;
- }
- ---------------
- /*
- * File: simlib.h
- * Author: Gerardo Cicalese
- *
- * Created on 5 giugno 2019, 13.23
- */
- #ifndef SIMLIB_H
- #define SIMLIB_H
- int pulisci(char *, int);
- int riempi(char *, int, char);
- int trova(char *, int, char);
- #endif /* SIMLIB_H */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement