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
What is page thrashing?
int main() { Int n=20,i; For(i=0;i<=n;i--) { Printf(“-“); Return 0;
Which are low level languages?
why we wont use '&' sing in aceesing the string using scanf
Can you return null in c?
Is c# a good language?
What is use of bit field?
What are file streams?
Explain how do you use a pointer to a function?
What is a lvalue
int far *near * p; means
Define the scope of static variables.
Explain what is page thrashing?
Find the second largest element in an array with minimum no of comparisons and give the minimum no of comparisons needed on an array of size N to do the same.
What is the explanation for cyclic nature of data types in c?