- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 0
- Posts with Upvotes
- 0
- Upvoting Members
- 0
- Downvotes Received
- 3
- Posts with Downvotes
- 2
- Downvoting Members
- 3
5 Posted Topics
/* Non-recursive Permutation generator By : Mudit Aggarwal */ #include<stdio.h> #include<string.h> void main() { /* String */ char ch[]="123"; char temp; int len = strlen(ch), count=1; int i, start=len-2, end=len-1; // Finds permutation count for(i=1; i<=len; i++) count *= i; for(i=0; i<count; i++) { //swap characters temp=ch[end]; ch[end]=ch[start]; ch[start]=temp; printf("%s\n",ch); …
for (llint i = 0;i != labs (diff) + 1; ){ or llint diff = labs (start < end ? start - end : (start == end ? 1 : end - start)), *genList = calloc (diff, sizeof (llint)); for (llint i = 0;i != diff + 1; ){ In …
try compiling this code and u can figure out the solution from the error. use character pointer for return. Instead of using char iResult ..use char array and return that. For loop should work properly.
You forgot to reset 'j' to zero in while loop
The above problem is an example of buffer overflow ( stack overflow) fread tries to store data in a buffer outside the memory the programmer set aside for it (12 bytes) Also it is a good practice to validate the file pointer after opening the file. You should check badfile …
The End.
muditAggarwal