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 / 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 |
What will be the outcome of the following conditional statement if the value of variable s is 10?
Explain what is the heap?
What is the use of gets and puts?
In which layer of the network datastructure format change is done
Write a program to find given number is even or odd without using any control statement.
which is an algorithm for sorting in a growing Lexicographic order
Is main a keyword in c?
Write a program that his output 1 12 123
What is the difference between %d and %i?
What do you mean by Recursion Function?
what is void pointer?
Explain how can I write functions that take a variable number of arguments?