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 |
What does *p++ do? What does it point to?
Is c a great language, or what?
how can i calculate mean,median,mode by using c program
Hai friends im a i year student. i want to develop my knowledge in the field of TSR in c. How I'm Improve ?
what is the output for this question: main() { int i=1; printf("%d%d%d",i,i++,++i); }
What are static variables, and where are they stored?
What is unsigned int in c?
main() { unsigned int k = 987 , i = 0; char trans[10]; do { trans[i++] =(char) (k%16 > 9 ? k%16 - 10 + 'a' : '\0' ); } while(k /= 16); printf("%s\n", trans); }
Why cant I open a file by its explicit path?
Does c have function or method?
Write the test cases for checking a variable having value in range -10.0 to +10.0?
program to find a smallest number in an array