how do i write a C programm with the output
++++++ or *******

how do i write a C programm with the output
++++++ or *******

Give it as an argument to the printf() function, or learn how to use a loop.

something like this:

for(int i=0; i<10; i++)
{
     printf("*"); // it will print '*' 10 times
}

for(int i=0; i<10; i++) /* Not proper C syntax */

int i;
for ( i = 0; i < 10; i++ ) /* correct syntax */

>for(int i=0; i<10; i++) /* Not proper C syntax */
Not proper C89 syntax. C99 supports this feature.

>for(int i=0; i<10; i++) /* Not proper C syntax */
Not proper C89 syntax. C99 supports this feature.

GCC defaults to C89. Add -std=c99 to the command line or to the settings of your IDE to use that syntax. Otherwise, you'll get a complain from the compiler.

Doesn't look like a matter of taste then?

It doesn't have anything to do with taste. It has to do with which standard your compiler is able to work with.

>GCC defaults to C89.
That's nice. What's your point? I don't see any mention of gcc from either mostafadotnet or the OP, so you can't claim that his compiler doesn't default to C99. Personally, I think we should be assuming C89 (thus, your response was correct), but I'm not particularly keen on the way you went about it or the way you defended it.

It's best to keep C99 in mind, even if it's extremely unlikely that you'll be dealing with it. Our whole purpose is to pass on as much knowledge as possible, right?

GCC defaults to C89. Add -std=c99 to the command line or to the settings of your IDE to use that syntax. Otherwise, you'll get a complain from the compiler.

Actually, GCC defaults to a GNU C mode by default, which is not the same thing as C89.

>That's nice.
I though so.

>What's your point?
To let the OP and people that read your follow up comment know that if their compiler complains about that particular syntax error, there's always a way of telling the compiler to use the C99 standard.

>I don't see any mention of gcc from either mostafadotnet or the OP, so you can't claim that his compiler doesn't default to C99.

You don't see any because there is none. However there's another post by the OP where he asks for a `free compiler' and sugestion has been given of using Dev-C++.

>Personally, I think we should be assuming C89 (thus, your response was correct), but I'm not particularly keen on the way you went about it or the way you defended it.

I personally always assume C89 because is a save default.
I quoted your comment as a reference of what I was pointing to. I don't have to defend anything. Nor it was a direct response to your comment.

>It's best to keep C99 in mind, even if it's extremely unlikely that you'll be dealing with it. Our whole purpose is to pass on as much knowledge as possible, right?
I agree with you there. That's why I mentioned about adding -std=c99 or similar to your compiler if it complains about C99 supported syntax.

>there's always a way of telling the compiler to use the C99 standard.
Assuming the compiler supports the C99 standard in any way. Not many of them do.

>You don't see any because there is none.
Oh good. I was starting to think my eyes were going bad.

>You don't see any because there is none.
Oh good. I was starting to think my eyes were going bad.

Off topic:
Hardly an accurate test to know if your eyes are going bad. Don't assume anything. Consult an ophthalmology.

This article has been dead for over six months. Start a new discussion instead.