How do you create a really large matrix (i.e. 3500x3500) in C
without having the program crash? I can only reach up to 2500.
It must have something to do with lack of memory. Please help!
Answer / gouri shanker m.ojha
using Dynamic memory allocation,you can create large array size.
example:m=1000000,n=1000000
void enter(int m,int n)
{
int i,j;
long int c=0;
matrix=new long int*[m]; /*m is row size*/
for(i=m-1;i>=0;i--)
{
matrix[i]=new long int[n]; /*n is col size*/
for(j=0;j<n;j++)
{
matrix[i][j]=++c;
}
delete matrix[i];
}
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Is the following code legal? void main() { typedef struct a aType; aType someVariable; struct a { int x; aType *b; }; }
writte a c-programm to display smill paces
main() { signed int bit=512, i=5; for(;i;i--) { printf("%d\n", bit = (bit >> (i - (i -1)))); } } a. 512, 256, 128, 64, 32 b. 256, 128, 64, 32, 16 c. 128, 64, 32, 16, 8 d. 64, 32, 16, 8, 4
Write a program to receive an integer and find its octal equivalent?
Which version do you prefer of the following two, 1) printf(“%s”,str); // or the more curt one 2) printf(str);
can u give me the c codings for converting a string into the hexa decimal form......
int DIM(int array[]) { return sizeof(array)/sizeof(int ); } main() { int arr[10]; printf(“The dimension of the array is %d”, DIM(arr)); }
#ifdef something int some=0; #endif main() { int thing = 0; printf("%d %d\n", some ,thing); }
how to print 1 2 3 4 5 6 7 8 9 10 9 8 7 6 5 4 3 2 1 using any loop(for or while) only once(only 1 loop) and maximum 2 variables using C.
19 Answers Cap Gemini, Infosys,
main() { register int a=2; printf("Address of a = %d",&a); printf("Value of a = %d",a); }
How can you relate the function with the structure? Explain with an appropriate example.
What is the difference between proc means and proc tabulate ? explain with a simple example when you have to use means or tabulate?