I have been trying to see where the problem is but couldnt find it. Every time, the values of array memory gives me 0, even though int count works and keeps counting as the struct data value, only array does not save the value.
#include<stdlib.h>
#include<stdio.h>
#define SIZE 1000
struct registers
{
int data;
} registerX;
void first(int *counter, struct registers* X1, int m[][2])
{
int value;
printf("Enter the value for the X\n");
scanf("%d", &value);
X1->data = value;
m[*counter][1] = X1->data;
*counter = ++*counter;
}
int main()
{
int memory[SIZE][2];
int choice;
int count = 0;
printf("Enter the instruction number:\n");
while(choice != 107)
{
scanf("%d", &choice);
if(choice == 101)
{
memory[count][0] = 101;
first(&count, ®isterX, memory);
printf("%d\n", memory[count][1]);
printf("%d\n", memory[count][0]);
}
}
}