top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to declare 2-D array without use row or column in c?

+1 vote
247 views

declare only like arr[10] but here arr[10] is 2-D

posted Jul 4, 2017 by Ajay Kumar

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button

Similar Questions
0 votes

See the following two program

#include<stdio.h>
int main()
{
  int a[][5] = { 1}; 
  printf("%d", sizeof(a)); 
}

Output: 20

#include<stdio.h>
int main()
{
  int a[2][5] = { 1}; 
  printf("%d", sizeof(a)); 
}

Output: 40

Can someone explain the logic why there is such difference of the size?

+3 votes

e.g. Suppose I enter a string : Ram and Shyam likes Ramesh then the output should be Ramesh and Shyam likes Ram.
Here first word Ram is swapped with Ramesh .

+2 votes

I need to get value from the below table

{  {1,25,{45,6,4},5,8,{10,15},1,4,0,0},    
   {0,25,{6,4},{1,2,5,8},5,{10,15},1,{7,5,2,6,11,15},4,0},    
   {0,2,3,4,5,8,{10,15},1,{1,2,3,4,5,6,7,8,9},0}
}

first index is fixed to 3 and in each index no of elements fixed to 10, but inside of some index no of elements is not fixed ... so how can i get this value. how to declare it .

I did like array_x[3][10][];

but its not working .. please suggest

...