Jump to content

Algumas Funções de Strings


Gurzi
 Share

Recommended Posts

Bem malta, vou deixar aqui algo básico mas que pode ajudar algumas pessoas 😛

Vou deixar funções que faço sozinho seguindo os problemas do Livro do Damas 🙂

Espero que possa ser útil futuramente 😛

Função updown(vai colocar a string introduzida assim " Eu GoStO dO pOrTuGaL a ProGrAmAr" )

char *updown(char *s)
{
  int i=0;
  for (i=0;s[i]!='\0';i++)
  {
   if(i%2 == 0)
   s[i] = toupper(s[i]);
  else
  s[i] = tolower(s[i]);
  }
return s;
}

-----------------------tem que utilizar a biblioteca ctype.h--------------------------

😛

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.