Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

How to print every other character of a string?

loofy12loofy12 Member Posts: 1
I have no idea how to do this. I'm thinking that I need to write a for loop and increment each character plus 2 and then print that result but I have no idea how to do it.

[code]#include
#include

void get_input()
{
char s[100];
printf("Enter a string:
");
fgets (s, 100, stdin );
}

void reverse()
{
char end;
char x;
char s[100];
end = strlen(s) - 1;
for (x = end; x >= 0; x--){
printf("%c
",s[x]);
}
}

void skip()
{
}

int main()
{
get_input();
reverse();
return 0;
}

[/code]

Sign In or Register to comment.