Problem in C

Ohh Man...

I didnt knew I was posting something which will get me flames... :(

I was just trying to help him out with a program. Maybe I missed something. But if you could be kind enough to show me my mistakes, I would make sure I dont repeat them.

Anyways, I think I missed out somewhere, so no frets.

Dont want any damages.
No Offence meant.
 
justin, no class in ur code.......seem to converted into C code..........however a little comment will help us to make it out easily
 
^^ I didn't make any personal remarks or comments. The moderated line only
criticized your hybrid (slang used) C/C++ code, which is obviously *far* from
a *complete standard C* program, as advertised. Nothing personal, again.

No offenses intended or taken, as usual.

Okay, here's a working, but weird C code to print all permutations disregarding
repetitions in input. This program accepts the input string as command line
argument, and will crash in case none is supplied.
Code:
#include <stdio.h>

int main(int a, char **b)
{
  char *c;
  if (*(c = a ? *b = b[1] : ++*b))
    for (main(0, b); *++c; *c ^= **b ^= *c ^= **b)
      main ((*c ^= **b ^= *c ^= **b, 0), b);
    else puts(b[1]);
  --*b;
  return 0;
}

Modification to this code, to print all permutations and combinations with
repetitions taken into consideration is left to fellow programmers as an exercise. ;)

As far as the OP is concerned, I'm not sure whether all permutations, or
combinations are required as output.
 
Back
Top