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 */

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.....


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.
//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?


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.


void main()

123 321
12 21
1 1

Be a part of the DaniWeb community

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