Write a routine that prints out a 2-D array in spiral order!
Answer / gajender singh
#define n 4
int A[n][n]={{1,2,3,4},{5,6,7,8},{9,10,11,12},
{13,14,15,16}};
int min=0,max=n-1,i,j;
while(min<max)
{
for(i=min;i<=max;i++)
printf("%d,",A[min][i]);
for(i=min+1;i<=max;i++)
printf("%d,",A[i][max]);
for(i=max-1;i>=min;i--)
printf("%d,",A[max][i]);
for(i=max-1;i>min;i--)
printf("%d,",A[i][min]);
min++;
max--;
}
| Is This Answer Correct ? | 17 Yes | 11 No |
can anyone please tell about the nested interrupts?
What could possibly be the problem if a valid function name such as tolower() is being reported by the C compiler as undefined?
What is the translation phases used in c language?
What are pragmas and what are they good for?
Write a program for Overriding.
What are type modifiers in c?
In which mode we open the file for read,write and append also in c ? a)W b)w+ c)r+ d)a
main use of recursive function a) processing speed high b) reduce program length/reduce repeated statements c) if you do not, use iterative methods like, for, while or do-while d) all the above
Differentiate call by value and call by reference?
What is structure padding & expalain wid example what is bit wise structure?
What is a structure member in c?
What is a symbolic constant?