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
How we can insert comments in a c program?
Write a program on swapping (100, 50)
Whats s or c mean?
What is bubble sort technique in c?
What is data types?
What are the advantages and disadvantages of a heap?
What is the use of structure padding in c?
Why c is called a middle level language?
Define Array of pointers.
how to solve "unable to open stdio.h and conio.h header files in windows 7 by using Dos-box software
How can I prevent another program from modifying part of a file that I am modifying?
Explain the difference between the local variable and global variable in c?
What should malloc() do?
Why is structure important for a child?
What are the functions to open and close file in c language?