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
Do string constants represent numerical values?
Explain what are the advantages and disadvantages of a heap?
How to set file pointer to beginning c?
write a program to concatenation the string using switch case?
What is exit() function?
What is c preprocessor mean?
‘SAVEPOINT’ and ‘ROLLBACK’ is used in oracle database to secure the data comment. Give suitable examples of each with sql command.
Explain what is the stack?
write a program to find out prime number using sieve case?
What math functions are available for integers? For floating point?
Who invented b language?
Can you explain the four storage classes in C?
Can the sizeof operator be used to tell the size of an array passed to a function?
Can the “if” function be used in comparing strings?
How can you tell whether two strings are the same?