#include<stdio.h>

int main()
{
    FILE *point;
    char others[35];
    int indexer,count;
    strcpy(others,"Additional lines.");
    point = fopen("tenlines.txt","a"); /* open for appending */
    for (count = 1;count <= 10;count++) 
    {
        for (indexer = 0;others[indexer];indexer++)
        {
            putc(others[indexer],point); /* output a single character */
            putc('\n',point); /* output a linefeed */
        }
        
    }
    fclose(point);
    getchar();
}

plz i cant understand the inner for loop in above programme...
[That indexer one]...
i hav already studied about fopen and other I/O functions...
but only cant understand the inner loop....
plzzzzzzzzzzzzzzzzzzzzzzzzz need ur help....
plz temme the full mechanism of the inner loop.....
plz
help

plzzzzz.......][/

Take alook at the strcpy function.

The C string will have a terminating null character.

In the for loop,

for (indexer = 0;others[indexer];indexer++)

when the index (indexer) reaches the index of this terminating null character , the loop will exit.

Please use the CODE tags properly.

in the above program
Others[]- an array which is storing a string "Additional lines"

Now this string "Additional lines" has to be put into tenlines.txt file.
point variable points to the cursor position of the file "tenlines.txt".
Two integers indexer and count are used in for loop.

for (count = 1;count <= 10;count++)
//is used for counting exactly two lines

for (indexer =0;others[indexer];indexer++)

//used for incrementing the array other[], from 0 to the last word it can accomodate.
Now
putc(others[indexer],point);
//putting the strings or values from others to point variable that actually points to the cursor position of tenlines.txtr files.

So basically this program copy your string and get it written into a text file

hai plz help me to understand c programming?

The inner loop simply put additional with new line between each char.because strcpy() simply add null string at the end of "Additional lines". That is"Additional\0lines".
so the "lines" omitted by strcpy()

pls help me .. how do code this one?

o
oo
ooo
oooo

pls help me :))

/*
Name : Praveen Kr.
E-mail: prvnkmr449@gmail.com
Mobile no.:+918808130075

please reply if my post is help for u or if any problem on c ask me on my email.
*/

#include<conio.h>
#include<stdio.h>

void main()
{
for(i=0;i<4;i++)
{
for(j=0;j<=i;j++)
printf("0");
printf("\n");
}
getch();
}

12344321
123 321
12 21
1 1

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.