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.



I have an array of 100 elements. Each element contains some text. i want to: append a star chara..

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

Post New Answer

More C Interview Questions

Do you know the difference between malloc() and calloc() function?

0 Answers  


Linked list is a Linear or non linear explain if linear how it working as a non linear data structures

0 Answers  


When a c file is executed there are many files that are automatically opened what are they files?

0 Answers  


main() { int arr[5]={23,67}; printf("%d%d%d",arr[2],arr[3],arr[4]); }

9 Answers   TCS,


write a program in c to read array check element is present or not?

1 Answers  






write a c program for print your name .but,your name may be small letter mean print a capital letter or your name may be capital letter mean print a small letter .example \\enter ur name : sankar The name is: SANKAR (or) enter your name:SAnkar The name is:saNKAR

5 Answers  


Explain indirection?

0 Answers  


In this problem you are to write a program that will cut some number of prime numbers from the list of prime numbers between 1 and N.Your program will read in a number N; determine the list of prime numbers between 1 and N; and print the C*2 prime numbers from the center of the list if there are an even number of prime numbers or (C*2)-1 prime numbers from the center of the list if there are an odd number of prime numbers in the list.

0 Answers  


What are identifiers in c?

0 Answers  


what is the mean of c languages.

1 Answers   Polaris,


main() { char x; while(x=0;x<=255;x++) printf("\nAscii value %d Charater %c",x,x); }

2 Answers  


What is #define?

0 Answers  


Categories