I would recommend you check out a few beginner tutorials as you have many things going wrong all at once. For instance, your if statement:


if (int c=0; c<r; c++)


What you are trying to use...