Here’s the way I’d do it (minimal number of variables needed):
for (i=0; s[i]; s[i]=='.' ? i++ : *s++);
More Related Contents:
- isnt everything where it should be, why the segmentation fault?
- Removing digits and all punctuation except apostrophe from a string in C
- returning string in C function [closed]
- What is the difference between char s[] and char *s?
- Why does strchr take an int for the char to be found?
- Return char[]/string from a function [duplicate]
- What is the proper way of implementing a good “itoa()” function?
- How does c compare character variable against string?
- Why does char* cause undefined behaviour while char[] doesn’t?
- Conversion of Char to Binary in C
- Does C have a string type? [closed]
- C split a char array into different variables
- Reading newline from previous input when reading from keyboard with scanf()
- Assigning char array a value in C
- String termination C/C++ char = 0
- ‘ ‘, ‘\n’ , scanf() and output screen
- Returning an array using C
- How do I concatenate const/literal strings in C?
- How to convert a string to integer in C?
- How do I trim leading/trailing whitespace in a standard way?
- Using the equality operator == to compare two strings for equality in C [duplicate]
- Case Insensitive String Comparison in C
- In C, why is sizeof(char) 1, when ‘a’ is an int?
- No compiler error when fixed size char array is initialized without enough room for null terminator
- Reading a string with spaces with sscanf
- How to convert a char array to a string?
- C char array initialization: what happens if there are less characters in the string literal than the array size?
- assigning more than one character in char
- Assign string to element in structure in C
- problems with char array = char array