- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 1
- Posts with Upvotes
- 1
- Upvoting Members
- 1
- Downvotes Received
- 2
- Posts with Downvotes
- 1
- Downvoting Members
- 2
7 Posted Topics
Re: Maybe what you want is this: [CODE] #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int i,j; char *str="Good, Morning!"; int len=strlen(str); char *Rstr=(char *)malloc(len+1); for(j=0,i=len-1;j<len;j++,i--) Rstr[j]=str[i]; Rstr[j]='\0'; printf("Original string:%s\n",str); printf("Reversed string:%s\n",Rstr); free(Rstr); return 0; } [/CODE] | |
Re: By changing the code to this:[CODE] C[i][j] += A[i][k] * B[k][j]; [/CODE] you can reduce accessing memory( or register) by ONE time. | |
Re: [QUOTE=y9john;1374284]Hi guys, I am working on a program for my c class and I was wondering anyone knows if it is possible to define a structure that has dynamic members. I think I saw a thread on this already but when I read it, it didn't quite make sense. This … | |
I want to create a double pointer and make it point to an double dimension array, then output the content of the array through the pointer. However Gcc warn me that "assignment from incompatible pointer type". Just like this: [CODE]#include <stdio.h> #include <stdlib.h> int main() { int i,j; int **p; … | |
Re: [QUOTE=Shift-Stop;1369064][code=c] // ----------------------------------------------- int mySquare(int y1) // rcv'ing dbl = 4 { double x1=1 ;// valid, but impossible to reach. printf("\n SQRD incoming Y1: %d",y1); // shows 4 printf("\n SQRD return y1*y1: %d",y1*y1); //shows 16 x1 = (int)(y1*y1); // ??? printf("\n SQRD return X1: %d",x1); //shows 0 ! return x1; … | |
Re: This's my implementary of merge sorting. [CODE]#include<stdio.h> #define N (11) // size of sorting array void msort(int a[],int low,int high); void merge(int a[],int low,int high,int mid); int main() { int low=0,high=N-1,count; int a[N]={0,9,7,8,6,0,2,1,5,4,3}; // original data printf("Before sorting: "); for(count=0;count<N;count++) printf("%d " ,a[count]); putchar('\n'); msort(a,low,high); printf("After sorting: "); for(count=0;count<N;count++) printf("%d … | |
Re: yes, U need another source file with int i defined in it. |
The End.