Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <ctype.h>
- #define MAX_LEN 1000
- ///Problem 6
- void stringSplit(char string[], char *pntr[], unsigned len){
- size_t i = 0, j = 0;
- char ant = ' ';
- int k = 0;
- while(string[i] && (len != k)){
- if(!isspace(string[i]) && isspace(ant)){
- pntr[j] = &string[i];
- j++;
- }
- ant = string[i];
- i++;
- k++;
- }
- pntr[i] = NULL;
- }
- int main(int argc, char **argv)
- {
- /**problem 6 */
- char string[MAX_LEN] = "This is it fams";
- char *pntr[15];
- stringSlplit(s,p);
- for(int i = 0; i != NULL; i++){
- printf("%s",pntr[i], 15);
- /** End of Problem 6 */
- int pos = 1;
- char **aux;
- for(int i = 0; i < argc; i++)
- if(argv[i][0] == '-'){
- printf("it entered the if \n");
- aux = argv[i][pos];
- argv[i][0] = argv[i][pos];
- argv[i][0] = aux;
- pos++;
- }
- for(int i = 0; i < argc; i++)
- printf("%10s\n", argv[i]);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement