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 / 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 |
Write a C/C++ program to add a user to MySQL. The user should be permitted to only "INSERT" into the given database.
write a programe returns the number of times the character appears in the string
What are the rules for identifiers in c?
Is fortran faster than c?
What are structure members?
the number 138 is called well ordered number because the three digits in the number (1,3,8) increase from left to right (1<3<8). the number 365 is not well ordered coz 6 is larger than 5. write a program that wull find and display all possible three digit well ordered numbers. sample: 123,124,125,126,127,128,129,134 ,135,136,137,138,139,145,146,147 148 149,156.......789
Example of friendly function in c++
how to execute a program using if else condition and the output should enter number and the number is odd only...
How many types of operator or there in c?
What are file streams?
how to get the starting address of file stored in harddisk through 'C'program.
main() { printf(5+"Vidyarthi Computers"); }