Thank you for your assistance in this matter. I appreciate your helpHere's a couple thoughts to help guide you.
This program does exactly what you're sayingMost of the time in your loop you need to print one value and one comma. That's easy. What may not be obvious is that you can print the comma either before the number or after the number. You are doing it the former way (which is the obvious way -- usually a reasonable place to start) and so you need to find a way to detect that you are printing out the last value and not print a comma in that case. Can you see how to rewrite your printf() statement so that it prints the comma before the number so that, except for the beginning and end of the line that is printed out, it looks the same as what you have now. If so, then your problem has been changed to detecting that you are printing the first value and not printing a comma in that case. Which is easier to detect, that you are printing the first value or the last value?
Code:
#include<stdio.h>
int main()
{
int array[5] = { 5, 6, 7, 8, 9};
int i = 0;
printf("%d, %d, %d, %d, %d", array[0], array[1], array[2], array[3], array[4]);
return 0;
}