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 |
#include<stdio.h> main() { int a=1; int b=0; b=++a + ++a; printf("%d %d",a,b); }
program to print upper & lower triangle of a matrix
What does the characters “r” and “w” mean when writing programs that will make use of files?
What is local and global variable in c?
What is the sizeof () a pointer?
What is the best way to store flag values in a program?
int i=0,j; j=++i + ++i ++i; printf(" %d",j);
The C language terminator is a.semicolon b.colon c.period d.exclamation mark
An array name contains base address of the array. Can we change the base address of the array?
What is ambagious result in C? explain with an example.
Explain a file operation in C with an example.
Tell us two differences between new () and malloc ()?