That's just declaring multiple variables of the same types.
It's like
int a, b;
The first line declares four variables of the type PetscInt
, called i
, n
(which is initialized to 10
), the array col[3]
and finally its
. The second line declares three variables of the type PetscScalar
.
So this:
PetscInt i,n = 10,col[3],its;
is the same as:
PetscInt i;
PetscInt n = 10;
PetscInt col[3];
PetscInt its;
Some find the original way shorter, easier to type, and also nice since it shows that the variables share (part of) the same type. Some find it confusing and/or error-prone, this is subjective of course but I felt I should mention it to kind of motivate why you often find code like this.