WebHosting

Wednesday, February 23, 2011

Initialize diagonal element with zero in a 2d array

 


#include <stdio.h>
#include <conio.h>
#include <string.h>
static int count=0;
static int pathsize;

void main()
{
int array[5][5];
int i=0,j=0;
for(i=0;i<5;i++)
array[i][i]=0;
for(i=0;i<5;i++)
{
for(j=0;j<5;j++)
{
printf(" [%d] ",array[i][j]);
}
printf("\n");
}
getch();
}

No comments:

Post a Comment

Thank you for Commenting Will reply soon ......

Featured Posts

How to Enable and Configure Remote Desktop (RDP) on Ubuntu 24.04.4 LTS

Remote Desktop Protocol (RDP) support in Ubuntu has become considerably easier with the GNOME Remote Desktop stack included in modern Ubuntu...