Not getting any output.Please help.

#include <stdio.h>
int cmp (int a,int b)
{
return (
(int
)a-(int)b);
}

 int main()
 {
     int t,s,i,j,a;
     scanf ("%d",&t);
     while (t--)
     {
     scanf ("%d",&s);a=0;
     	for (i=1;i <=s;i++)
     	{ int k [i];
     		for (j=0;j<i;j++)
     		{
     			scanf ("%d",&k [j]);
     		}
     	qsort (k,i,sizeof (int),cmp);
     	if (i=1)
     	{
     		a+=0;
     	}
     	else
     	{
     	a=a+k [i-1];}
     	}
     	printf ("%d\n",a);
     }
 	
 }  

Im trying to solve Triangle of Numbers.Please tell me whats wrong with my code .Im not getting any output.

Please use direct link or markdown while pasting you code…

There’s 2 mistakes that are clear for me.

  1. after your qsort, the statement after the if became an assignment instead of equality check. To avoid this sort of error, you may reverse their order (like 1 == i instead of i == 1) so that it will raise and assignment error if you are short of one “=”.
  2. The return 0 at the end. Your function isn’t a void but an int right?

It may be better if you don’t forget to place comments on your code for clarity. It sometimes help for clarifying what you really want to do during that line…
Hope this helps! :]

Also, try checking this link

//