I made following changes.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void parse_my_string(char**, char *, char *);
int count_spaces(char*);
Type: Posts; User: Pingoo
I made following changes.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void parse_my_string(char**, char *, char *);
int count_spaces(char*);
something like this:
#include <stdio.h>
#include <string.h>
char **parse_my_string(char [][], char *, char *);
char parsed_str[5][20];
I made the following changes:
char **parse_2D(char parsed_arr[5][20], char *str_to_be_parsed, char ch)
{
strcpy(parsed_arr[0], str_to_be_parsed);
--------
--------
return...
I tried to allocate char arr_str[5][10] before the function definition. It complied without any errors. But, when I tried to test it in the main, It is giving me error: "error C2664: 'strcpy' :...
Hi,
I want to write a function to parse a string, which will return the parsed strings in the array format.
I just wanted to know how should I declare my function which will return me an array...
Thanks for correcting me. It is working fine now.
gdb was useful too.
After doing the required changes, I am getting following output
$ gcc -o trim trim_whitespace.c
$ ./trim This is a test string.
The value of i is 1
Trimed string is This
The value of i is...
I am taking cmd line arguments and calling this function to trim the whitespaces.
int main(int argc, char **argv)
{
char str[100];
int i;
for(i=1; i<=strlen(str); i++)
{...
Hi,
I am trying to write a C program to trim whitespaces before the string. But, it isn't working properly. Following is what I tried
char *lefttrim(char *str)
{
int i=0;...