S
sonaliagr
I am trying to update a msg[11][11] array in function by passing the
address but it is showing an error. and also, i want the value of msg
array to be accessible to the full code that is inside the main
function...I hope i am making sense...Please look at the code and help
me in pointing out the error..
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
void generateMessage_matrix(int *msg[11][11],int k, int loops);
void main()
{
int *msg[11][11];
printf("\n Enter the code parameters and field k:");
scanf("%d",&k);
generateMessage_matrix(msg,k);
}
void generateMessage_matrix(int *msg[11][11],int k)
{
int i,j;
float x;
srand((unsigned)time(NULL));
for (i=0;i<k;i++)
{
for(j=0;j<k;j++)
{
x = rand()/(RAND_MAX + 0.0);
if(x > 0.5)
msg[j] = 1;
else
msg[j] = 0;
}
}
}
address but it is showing an error. and also, i want the value of msg
array to be accessible to the full code that is inside the main
function...I hope i am making sense...Please look at the code and help
me in pointing out the error..
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
void generateMessage_matrix(int *msg[11][11],int k, int loops);
void main()
{
int *msg[11][11];
printf("\n Enter the code parameters and field k:");
scanf("%d",&k);
generateMessage_matrix(msg,k);
}
void generateMessage_matrix(int *msg[11][11],int k)
{
int i,j;
float x;
srand((unsigned)time(NULL));
for (i=0;i<k;i++)
{
for(j=0;j<k;j++)
{
x = rand()/(RAND_MAX + 0.0);
if(x > 0.5)
msg[j] = 1;
else
msg[j] = 0;
}
}
}