I am trying to solve this in c programming, maybe the logic that I provided is not working as expected.
Type: Posts; User: leo2008
I am trying to solve this in c programming, maybe the logic that I provided is not working as expected.
Below are the comments added inline here.
What is "k-drome"? A string is k-drome if it can be transformed into a palindrome, by removing at the most N characters from it.
What do you mean...
I am trying to find the amount here.
Input
The first line of input contains an integer M, the number of coins in bank.
The second line of input contains M integers: coin1, coin2... coinN. coini...
I am trying to resolve the below string manipulation.
But code doesn't work as expected. Need help with some inputs.
Input
First line of input contains string M, consisting of lowercase...
How can I prevent return a pointer in this case?
I have the below code which has issue with double return value. How can I fix it?
double *funct( double i )
{
double result = 2.0 * i;
return &result;
}
do you mean to say that we should not use sort algo in this case? If so, how can we solve this? The issue here is that there is a list which is sorted already, except for one item which is in wrong...
do you mean to say that we should not use sort algo in this case? If so, how can we solve this?
When one item in the list is in wrong place, should I use Merge sort or Bubble sort considering the time complexity of sort algo?
I have some basic doubts with data structure usage.
Please confirm if my below understanding is correct.?
Link List can be used to frequently need to add and remove elements from the middle of a...
Hi rstanley
Did you write any new function to handle negative values?
If I provide positive numbers there are no issues seen, with the existing logic.
Enter a number and base
12 2
String :...
I identified problem was due to 2 files with the same name, after renaming it, i was able to resolve compile issues.
Tested and it shows below output. if I provide negative number it gives strange...
If I test below code, it throws errors. I am not sure why these errors are coming here?
Where are these multiple definitions for itoa, main and reverse?
#include <stdio.h>
#include...
I have modified the below code and tested output below. But it doesnt print any string values after providing number and base. Can someone help me understand what is wrong in this code?
...
If I remove stdbool.h, I get the below errors.
main.c:28:1: error: unknown type name ‘bool’
28 | bool isnegative = false;
| ^~~~
main.c:37:1: error: unknown type name ‘bool’
...
I have removed the const input and below is my code. please check it.
#include <stdio.h>
#include <stdbool.h>
#define true 1
#define false 0
How to change code logic to handle negative to positive? I mean change -726 to +726. In your itoa function, something like this?
if((signal = n)<0)//record signal
n=-n;//make n a positive...
As per your logic, it output as -726. How can I used void function to implement itoa? I need to use below signature.
void itoa (const int input, char* output) {}
can anyone help me? i am stuck with this code.
Modified code as below, but has compile errors.. what is wrong here?
#include <stdio.h>
#include <stdbool.h>
#define true 1
#define false 0
I changed code logic as below, but getting compile errors. what is wrong here?
#include <stdio.h>
#include <math.h>
#include <string.h>
void itoa (const int input, char* output, int...
Below is the reverse function logic.
void reverse(char output[])
{
int i, j;
char c;
for (i = 0, j = strlen(output)-1; i<j; i++, j--) {
Hi
I need help with implementing itoa function as below. What is wrong with my below code? It has compilation errors.
#include <stdio.h>
#include <math.h>
#include <string.h>
This is not MCQ, I suspected those could be the reasons. My strong suspect is that static member function doesn't need to be called from an instance of their own class . i am not a design pattern...
Did you mean to say that is it because static inheritance allows objects to be instantiated or static member data can be shared across all instances or static member function doesn't need to be...