0

How to enter char in integer array in c

In an array, replace all the prime numbers with ‘ * ‘ & remove all the odd numbers.

9th Jun 2022, 10:00 AM
Ajmal K saleem
Ajmal K saleem - avatar
3 Answers
+ 2
Asterisk '*' ASCII code is 42. You can put 42 in place of the prime element everytime you find one. When done with the operation, check whether an element value was 42 as you print the array elements. If so, print the element value using %c specifier instead of %d. This assumes there is no element with value 42 in original array.
9th Jun 2022, 11:08 AM
Ipang
0
Manav Roy not that bro, i want to put star sign in int array. How is that possible. This is the real question 👇 In an array, replace all the prime numbers with ‘ * ‘ & remove all the odd numbers.
9th Jun 2022, 10:17 AM
Ajmal K saleem
Ajmal K saleem - avatar