Counting spaces in order to output

Using C programming. How do i go about counting spaces in a string? I am suppose to be able to output the command , number of parameters, and parameters (using atof)

so far i have





#include <stdio.h>
#include <string.h>
void my_func(char *input,char*command,int *num_params, float params);
void main(void)
{
char input[20]={};
char command;
int num_params[20]={};
float params ;
printf("Enter a command :");
atof(gets(input));
my_func(input,command, num_params,params);
}
void my_func(char *input,char*command,int *num_params, float params)
{
do
{
int i=0;

printf("\n\n");

printf("%c", input[i]);
i++
}

while (input[i] != 32)

while (input[i] != 32)
{

num_params = num_params +1
i+2

}


printf("\n\n");

printf("Number of Parameters: %i",num_params );

}
Topic archived. No new replies allowed.