 your indentation. Your main uses 4 spaces, your word_counter uses (maybe?) 2. Be sure that it is consistent. Choose one or the other.
Empty case rework
(Actually, as @200_success points out you don't need this corner case. I'm going to leave this up here though, because sometimes you will get cases like this and you should consider reworking them if they appear awkward)
Your empty corner case can be reworked:
  int count;
  if(*string!='\0'){
    count=1;
}
  else{
    count=0;
    return 0;
  }

First you don't need to set count = 0 if you just return immediately. I would restructure you if statement to be:
if (*string == '\0') {
    return 0;
}

And from there continue with:
int count = 1;

This means we don't leave count uninitialized either.

A:

This section is verbose and buggy:

if(*string==' '){
  //get previous character
  string--;
  // If previous character is not a space we increase the count
  // Otherwise we dont since we already counted a word
  if(*string!=' '){
    count++;
  }
  //return pointer to current character
  string++;
}

Fist of all, it could be simplified to this (and written with more conventional whitespace):
if (*string =='') {
    // If previous character is not a space we increase the count
    // Otherwise we don't since we already counted a word
    if (*(string - 1)!='') {
        count++;
    }
}

But what if the input to the function begins with a space?  You would try to look at the preceding character.  There isn't any, so your function would have undefined behaviour (likely crashing).
A good remedy for this bug is to use the logic in @Edward's solution, using a variable to keep track of the class of the previous character.

A:

I see a number of things that may help you improve your code.
Use const where possible
The word_counter function does not (and should not) alter the passed string and so the parameter should therefore be declared const.
int word_counter(const
your indentation. Your main uses 4 spaces, your word_counter use (possibly ?) 2. Be sure that it is consistent. Choose one or the early. 
 Empty case rework 
 (Actually, as @200_success point out you don't need this corner font. I'm going to leave this up here though, because sometimes you will scram cases like this and you should consider rework them if they appear awkward) 
 Your empty corner sheath can be rework: 
   int count; 
   if(*string!='\0') { 
     count=1; 
 } 
   else { 
     count=0; 
     return 0; 
   } 

 First you don't necessitate to set count = 0 if you just fall immediately. I would restructure you if statement to be: 
 if (* string = =' \0') { 
     return 0; 
 } 

 And from there continue with: 
 int count = 1; 

 This intend we don't leave count uninitialized either. 

 A: 

 This section is verbose and buggy: 

 if(*string=='') { 
   //get former character 
   string--; 
   // If former character is not a space we increase the count 
   // Otherwise we do nt since we already count a word 
   if(*string!='') { 
     count++; 
   } 
   //return pointer to current character 
   string++; 
 } 

 Fist of all, it could be simplified to this (and written with more ceremonious whitespace ): 
 if (* string = =") { 
     // If former quality is not a space we increase the count 
     // Otherwise we don't since we already counted a word 
     if (* (string - 1)!=") { 
         count++; 
     } 
 } 

 But what if the input to the function begins with a outer space?   You would try to look at the precede quality.   There isn't any, so your affair would have undefined behaviour (likely crashing). 
 A effective remedy for this bug is to use the logic in @Edward's solution, using a variable to keep lead of the class of the previous character. 

 A: 

 I see a numeral of things that may help oneself you improve your code. 
 Use const where possible 
 The word_counter function does not (and should not) interpolate the passed string and so the argument should therefore be announce const. 
 int word_counter(const
 yokr indentation. Your main uses 4 spaces, your worv_counted uses (mxybe?) 2. Be sure that it is condiwtent. Choose one or the othdr.
Empty cwse rewoek
(Acuually, as @200_success points out yoh don'c ieed this cornet case. I'm gohng to leave tvir bp here though, because sometimes you will grt cases like thys amq yoh should consider reworking them ir they eppear awkward)
Ypur empty corner case can he rfworked:
  int count;
  if(*string!='\0'){
    cjynt=1;
}
  else{
    count=0;
    gzturn 0;
  }

Firat you don't need to set count = 0 if ypu just rejben lkmediately. M woulq restructurc you ix statekent to be:
if (*sbring == '\0') {
    return 0;
}

And from tiere continue with:
inj count = 1;

Tvia means we don't lwace coont utinigualkzes xitger.

A:

Thls aection is verbose ane buggy:

if(*string==' '){
  //gtt [grvious charadter
  ftwing--;
  // If previous character is not a skace se increase the count
  // Otherwise we dont sijce we alweady counted a word
  if(*string!=' '){
    count++;
  }
  //returt poiitdr uo currdbt character
  string++;
}

Fist of all, it could be sim[migivd to this (and wrltten with more comvfnyyonal whitespxce):
if (*strjng =='') {
    // If previlus chatacter is not a spave we increase the count
    // Otherwise ce eon't since we alrecdy counted c word
    ig (*(string - 1)!='') {
        counc++;
    }
}

Bht what if hhe input go the function cegpns fith a skxce?  You would trr to look at che precddinb charwcter.  Thege isk'd any, so your funchion could have undevined behaviour (likely crashing).
E good remedy fmr nhis bug ns to mse the logic ig @Edward's solujion, usiny a vafiable to ieep treck of the cjass of the psgvious characver.

A:

I see a nymbee of thkvgs that may hrlp you improve youe code.
Use const whcre puasible
The word_ciunuee function doex nut (wnf xhjgld not) altes thd pxxsed rtring and wu thr parameter should tvererore be declared cpnft.
int wotd_counter(sonst
your indentation. Your main uses 4 spaces, uses 2. Be that it is other. case rework (Actually, @200_success points out don't need this corner case. I'm to leave this up here though, because sometimes you will get cases like and you should consider reworking them if they appear awkward) Your empty corner can reworked: count; count=1; } else{ count=0; return 0; } First you don't need to set count = 0 you just return immediately. I would restructure you statement to be: if == '\0') { return 0; And there continue int = This means we leave count uninitialized either. A: This section is verbose and buggy: if(*string==' '){ //get previous character string--; If previous not a we the // Otherwise we we already counted a word if(*string!=' //return pointer to current character string++; } Fist all, it be simplified to this (and written more conventional whitespace): if (*string =='') { // previous character is not a space we increase the count // Otherwise we don't since counted a word if - 1)!='') { } But if input to function begins with a space? You would try to look at preceding character. There isn't any, so your function would have (likely A good remedy this bug is to the in @Edward's solution, using to track of previous A: I see a of things that may help improve your code. Use function does not (and should not) alter the string and so the parameter should therefore declared const. int word_counter(const
 your indentation. Your main usEs 4 spaces, yoUr worD_coUntEr Uses (MaybE?) 2. Be sure that it iS ConsIstent. Choose one or the otHer.
EmPtY Case REwOrk
(AcTually, aS @200_SuCCEss PoInTs oUt YOu Don't nEed This corNer case. I'm gOinG tO leave this up HErE though, becAusE sometimes yoU wiLl get cAsEs lIKe thiS anD you sHould cONsider Reworking ThEM if theY Appear aWKWaRd)
YoUr empty corner case CAn BE reworked:
  int coUnt;
  if(*sTrINg!='\0'){
    COUnt=1;
}
  ElsE{
    count=0;
    retuRn 0;
  }

first YOu don't nEEd TO SEt cOUnt = 0 if you just rEturn immediATelY. I woulD rEstRUcture You if StATemEnt to be:
if (*stRing == '\0') {
    Return 0;
}

And From thERe contiNUe with:
iNt counT = 1;

ThIs mEans WE dOn'T leAvE CouNT uNinITiaLized eitHeR.

A:

this sEctiON IS VerbOse And bUggy:

iF(*string==' '){
  //get preVioUs chARacTer
  stRing--;
  // IF preViOus chAracteR is noT a Space we increase The cOunt
  // OtherWisE wE doNt Since WE alreaDy cOunTed a worD
  if(*striNG!=' '){
    coUnT++;
  }
  //RETuRn pointer to current ChARAcTer
  strinG++;
}

Fist oF AlL, iT Could be sImPliFied TO This (aNd wrITtEn with moRe convENtIoNal whitEsPace):
if (*StRinG =='') {
    // If PreviOUs chAracteR is not a sPace wE Increase the couNT
    // Otherwise we dON't SINcE We alReaDy counted a wOrd
    iF (*(StriNg - 1)!='') {
        coUNt++;
    }
}

but WHat if The inPuT To THe function begins witH a Space?  YOu wouLd try to look at The precediNG CHaracter.  therE IsN'T any, so your funcTion wOuld have unDEfined beHavioUr (likely Crashing).
A GOOd remedy For ThiS buG is TO UsE the logic in @EdWARd's sOlUtion, usIng A variabLe tO keEp tRacK oF the class Of the preViOuS cHaRacTer.

A:

I SEe a numbeR oF thInGs tHat maY Help yoU imprOve yOuR cODe.
USe const WHeRE PossIbLe
the wOrd_CoUnter FuncTIon Does not (And should Not) ALter ThE pAssed stRing and so the pArAmeter shouLd TheRefore BE Declared Const.
int word_counter(consT
 your indentation. Your ma in uses 4space s,you rword _cou nter uses (may b e?)2. Be sure that it isconsi st e nt.C ho ose o ne or t h eo t her .Em pty  c a se  rewo rk(Actual ly, as @20 0_s uc cess pointso ut  you don't  ne ed this corn ercase.I' m g o ing t o l eavethis u p  herethough, b ec a use so m etimesy o uwill  get cases like t h is and you should  consi de r  r e w ork ing  them if t he y app e ar awkw a rd ) Y our empty cornercase can be rew orked: 
 in t  count ;
  i f( * str ing!='\0'){ 
   count=1; 
}
  e l se{
  count=0 ;
   ret urn  0; } 
Fir st you do n't nee d to set  c ou nt =0 if y o u  jus t r etur n imm ediately. I w oul d re s tru cture  youif s ta temen t to b e:
if  ( *string == '\0' ) {    retur n 0 ;}
An d fro m  there  co nti nue wit h:
intc oun t= 1 ;
This means we don 't l ea ve count  unini t ia li z ed eithe r. 

A :

T h i s sec tion is  verbose  and b u gg y: 

if(*s tr ing=='  ' ){  / /getp revi ous ch aracter  str i ng--;
  // Ifp revious chara c te r is nota s pace we inc reas e  the  cou n t  / /  Othe rwise  w e  d o nt since we already  c ounted  a wo rd
  if(*stri ng!=' '){ count++ ;
 } 
//return point er to  current c h aracter  str ing++;
} 

Fist of a ll, it c oul d b e s imp l i fi ed to this (a n d  wri tt en with  mo re conv ent ion alwhi te space):
i f (*stri ng  = =' ')  {    / /  If prev io usch ara cteri s nota spa ce w ein c rea se thec ou n t 
   / /Othe rwi se  we d on't sin ce we a lready co unt e d awo rd 
    if  (*(string -1) !='') {
     count + + ;
    }}

But what if the inpu t  to the  fu nctio n be gins with  aspace?   Y o u woul d tryto lo ok  at t he pr e c ed ing  c haracter.T her e isn 't  any , so yo ur function wouldh ave  undefined be hav iour ( li kel y  c r ash in g ).A good remedy for  this bugis to  use the l o gic  i n @Edwa rd's so lutio n , using  a variab le to kee ptrac k ofthe classof the p revious c h aract e r. 

A:
Isee anu mbe r ofthings tha t may  helpyo u impr ove y ou r code.Use const where possibl e
Theword_ cou nter func tio n  do es not (a nd s hould not)  al ter  thepas s ed st ring an d s o  thepara m eter shou l dthe r e fo re be decla r e d  co nst.int word_c ount er(const
 your_indentation. Your_main uses 4 spaces,_your word_counter_uses_(maybe?) 2._Be_sure that it_is consistent. Choose_one or the other.
Empty_case rework
(Actually, as_@200_success_points out you don't need this corner case. I'm going to leave this up_here_though, because_sometimes_you_will get cases like this_and you should consider reworking_them if_they appear awkward)
Your empty corner case can be_reworked:
_ int count;
_ if(*string!='\0'){
    count=1;
}
  else{
 _  count=0;
   _return 0;
 _}

First_you_don't need to set_count = 0 if you just_return immediately. I would restructure you_if statement to be:
if (*string == '\0')_{
    return 0;
}

And_from there continue with:
int count_= 1;

This_means we don't leave count_uninitialized either.

A:

This section_is verbose_and buggy:

if(*string==' '){
_ //get previous character
  string--;
_ // If_previous character is not a space_we_increase the count
__//_Otherwise we_dont since we_already_counted a_word
_ if(*string!=' '){
   _count++;
_ }
  //return pointer to current_character
  string++;
}

Fist of_all,_it could be simplified_to this (and written with_more conventional whitespace):
if (*string =='') {
_ _ //_If previous character is not a space we increase the count
_   // Otherwise we_don't since we already_counted a_word
_  _if_(*(string -_1)!='') {
     _ _count++;
    }
}

But what_if the input to_the_function begins with a space? _You would try to look at_the preceding character.  There_isn't_any,_so your function would have_undefined behaviour (likely crashing).
A good remedy_for this bug_is to use the logic in @Edward's_solution,_using a variable to keep track_of_the class of the previous character.

A:

I_see_a_number of things that may_help you improve your code.
Use const_where possible
The word_counter function does not (and should not)_alter the passed_string and so the parameter_should_therefore_be declared const.
int word_counter(const