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 |
How macro execution is faster than function ?
Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the maximum number of concurrent threads that the InnoDB plug-in can create.
1. Write the function int countchtr(char string[ ], int ch); which returns the number of times the character ch appears in the string. Example, the call countchtr(“She lives in NEWYORK”, ‘e’) would return 3.
int i =10 main() { int i =20,n; for(n=0;n<=i;) { int i=10 i++; } printf("%d", i);
how can i get output like this? 1 2 3 4 5 6
Why void main is used in c?
Explain the use of 'auto' keyword
How do you initialize function pointers? Give an example?
difference between my-strcpy and strcpy ?
3 Answers Geometric Software, IIM, Infosys,
What is sizeof array?
What are the features of c language?
print the pattern 1 2 4 3 6 9 4 8 12 16 5 10 15 20 25 if n=5