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

Kali Linux Remote Desktop: Access GNOME from Windows Using Native RDP

  Kali Linux + GNOME 50 + GNOME Remote Desktop + Windows Remote Desktop (MSTSC) Getting a full GNOME desktop remotely on Kali Linux can be ...