char s[] and char *s not the same?
I always though that char s[]
and char *s
were essentially the same in simple C functions.
Yet the following code gives me a segmentation fault
at runtime.
Comparing a string that is reversed is not working
I am using the below function and getting the below output. Can someone please explain why.
It prints out that they are equal after the for loop finishes but when compared the logic says they are not equal.
Made a string capitalizer in c and it breaks if it encounters a space
The title basically sums it up. I first compared if the characters of the string are in between a and z. then, if they are, reduced their ascii by 32, hence obtaining their capitals.
how to compare an array of strings with a string entered by the user
Let’s say I have an array of strings.
string ban[3] = {"Ben","Lina", "Adam"};
I ask the user to enter his name.How to make sure that the check was not exactly accurate, but for example, if you write not just Adam, but Adam1990, then it was not missed
How to add a two-digit number to stack
I am currently writing a code that inputs a function as a string from the user, coverts it to a postfix expression, then converts it to infix, then evaluates the expression.
Using fgets() in a for loop in C
Consider my following code:
im trying to do this program but the output is unexpected
(https://i.sstatic.net/JyErUZ2C.png)](https://i.sstatic.net/Jf3NmBs2.png)(https://i.sstatic.net/0ky5hvsC.png)
What is the simplest way to read a string until the first space character?
I have a string which contains some command line arguments for a calculator. What sort of argument it is can be determined by the first word in the string. For example:
Why does this code print 0 no matter what the input was?
#include <iostream> #include <string> using namespace std ; int main() { int t ; cin >> t ; int range ; cin >> range ; int counter = 0 ; while ( t– ) { int j = 0 ; string num ; cin >> num ; for ( char i : num ) { […]
what are the steps of coverting a string into a mathmatical function in c?
I am trying to write a program in c that converts a string into a mathematical function to be used in my program. For example: the user will input x+3+7 as a string then the program will convert it to an equation that can be calculated.