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 advantage of an array over individual variables?
What is the difference between union and anonymous union?
What is the difference between fread and fwrite function?
Is it possible to execute code even after the program exits the main() function?
What is time null in c?
main use of recursive function a) processing speed high b) reduce program length/reduce repeated statements c) if you do not, use iterative methods like, for, while or do-while d) all the above
can anyone suggest some site name..where i can get some good data structure puzzles???
Why C language is a procedural language?
What is a pointer on a pointer in c programming language?
What are the types of c language?
Explain why C language is procedural?
Is null always equal to 0(zero)?
What is indirection in c?
Is python a c language?
Explain what does it mean when a pointer is used in an if statement?