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 the purpose of scanf() and printf() functions?
The __________ attribute is used to announce variables based on definitions of columns in a table?
write a program to generate address labels using structures?
What is the best organizational structure?
I have written a pro*C program to fetch data from the cursor. where in i have used the concept of BULK FETCH.... each FETCH statement is taking lots of time to fetch specified number of rows at...
What is the difference between ‘g’ and “g” in C?
where are auto variables stored? What are the characteristics of an auto variable?
What are the features of c language?
What are the similarities between c and c++?
1. Write a function to display the sum of two numbers in the following ways: By using (i) pass by value (ii) pass by address a. function with argument and with return value b. function with argument and without return value c. without argument , with return value d. without argument , without return value Note: Use pass by address.
Is there any possibility to create customized header file with c programming language?
What is a protocol in c?
What is the purpose of sprintf() function?
What is hashing in c?
What does the format %10.2 mean when included in a printf statement?