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 |
main() { while (strcmp(“some”,”some\0”)) printf(“Strings are not equal\n”); }
write a program in c language to get the value of arroy keys pressed and display the message which arrow key is pressed?
print numbers till we want without using loops or condition statements like specifically(for,do while, while swiches, if etc)!
Printf can be implemented by using __________ list.
main() { int i; printf("%d",scanf("%d",&i)); // value 10 is given as input here }
write a program to Insert in a sorted list
main() { extern int i; { int i=20; { const volatile unsigned i=30; printf("%d",i); } printf("%d",i); } printf("%d",i); } int i;
writte a c-programm to display smill paces
Is there any difference between the two declarations, 1. int foo(int *arr[]) and 2. int foo(int *arr[2])
main() { int *ptr=(int*)malloc(sizeof(int)); *ptr=4; printf("%d",(*ptr)+++*ptr++); }
Write a procedure to implement highlight as a blinking operation
Give a one-line C expression to test whether a number is a power of 2.