I have an array of 100 elements. Each element contains some
text. i want to:
append a star character to the end of every fifth element
remove every second character from every tenth element,
and…
add a line feed (ascii 10) after the 30th character of
every array element whose length is greater than 30
characters.

Answer Posted / ravi joshi

int process_str()
{
int i, j;
char *ptr[100] = {"some text here"};
int len = 100;

for(i = 0; i < len; i++)
{
if(!(i % 5))
{
// process fifth element
}
elseif(!(i % 10))
{
// process 10th element
}
elseif(!(i % 30))
{
// process 30th element
}
}
}

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How we can insert comments in a c program?

634


Write a program on swapping (100, 50)

638


Whats s or c mean?

594


What is bubble sort technique in c?

593


What is data types?

642






What are the advantages and disadvantages of a heap?

715


What is the use of structure padding in c?

564


Why c is called a middle level language?

634


Define Array of pointers.

636


how to solve "unable to open stdio.h and conio.h header files in windows 7 by using Dos-box software

2802


How can I prevent another program from modifying part of a file that I am modifying?

615


Explain the difference between the local variable and global variable in c?

605


What should malloc() do?

646


Why is structure important for a child?

604


What are the functions to open and close file in c language?

730