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


Please Help Members By Posting Answers For Below Questions

Do string constants represent numerical values?

911


Explain what are the advantages and disadvantages of a heap?

593


How to set file pointer to beginning c?

662


write a program to concatenation the string using switch case?

1551


What is exit() function?

558






What is c preprocessor mean?

781


‘SAVEPOINT’ and ‘ROLLBACK’ is used in oracle database to secure the data comment. Give suitable examples of each with sql command.

1872


Explain what is the stack?

631


write a program to find out prime number using sieve case?

1632


What math functions are available for integers? For floating point?

616


Who invented b language?

911


Can you explain the four storage classes in C?

637


Can the sizeof operator be used to tell the size of an array passed to a function?

610


Can the “if” function be used in comparing strings?

584


How can you tell whether two strings are the same?

821