User Profile
Collapse
-
How to replace the contents in a memory location?
...Code:#include <stdio.h> #include<stdlib.h> int **matrix_mul(int **m1,int **m,int a,int b,int c,int d); main() { int i,j,r1,r2,c1,c2,**p,**q; printf("Enter the number of rows and columns of first matrix :\t"); scanf("%d%d",&r1,&c1); -
1.thanks.. that helps. so i need not have to allocate memory for x_transpose, and just need to declare as
????Code:int **x_transpose
2. i am afraid i did not get the sentence,
"As far reuse goes any allocated memory is your to use as often as you wish until you free it. The real trick is keeping all of the addresses of your allocations in scope. If you lose an address you lose the allocation. "
3. where should...Leave a comment:
-
actually i should work on c itself. not even c++. answer was informative, but any other way to do it in c itself. what about using the library Libsndfile???Leave a comment:
-
How to read an audio file in C?
is there any alternative for wavread (in matlab) in c. i want to get the samples, sampling frequency and bits per sample??? -
-
vineesh vs started a topic How to reuse the dynamically allocated memory inside a function in main()?in CHow to reuse the dynamically allocated memory inside a function in main()?
...Code:#include<stdio.h> #include<stdlib.h> int **transpose(int **x,int m,int n); main() { int nrows=2,ncolumns=2,i,j,k=0; //memory allocation for array x int **array; array = malloc(nrows * sizeof(int *)); if(array == NULL) { printf("out of memory\n"); -
...Code:#include<stdio.h> #include<stdlib.h> void function(int **x); main() { int nrows=2,ncolumns=2,i,j; //memory allocation for x int **x=malloc(nrows*sizeof(int*)); if(x==NULL) { printf("out of memory\n"); return 0; } for(i=0;i<nrows;i++) { x[i]=malloc(ncolumns*sizeof(int));Leave a comment:
-
in the line 32 why dont we use
instead ofCode:array =(int**) malloc(nrows * sizeof(int *));
is this because the compiler take the int datatype as defaultCode:array = malloc(nrows * sizeof(int *));
Leave a comment:
-
How to return arrays from function using pointer_segmentation fault?
...Code:#include<stdio.h> #include<stdlib.h> int **array(); main() { int **result=array(),i,j; //display result for(i=0;i<2;i++) printf("\n"); for(j=0;j<2;j++) printf("%d \t",result[i][j]); } //function int **array() {
No activity results to display
Show More
Leave a comment: