Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
N

nsoneja

@nsoneja
About
Posts
1
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • One of My Interview Questions Today
    N nsoneja

    cmk wrote:

    That's the way i've usually seen it done, i use something like: bool strrev_ip( char *s ){ if( !s ) return(false); char *e = s + strlen(s)-1; for( ; s < e; s++, e-- ) { *s ^= *e; *e ^= *s; *s ^= *e; } return(true);}

    Nice touch adding the xor way of swapping variables...that's usually a separate interview question in its own right! Also, precludes using a temp variable, which could come across as a loophole (ie; instead of allocating another string)...Hmm can't imagine how they would do it vastly differently than whats outlined in the original posting, all seem to be some variation of swapping chars till the pointers cross over

    The Lounge career
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups