Questions tagged [strlen]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
32 views

Readability CS50 Not counting the spaces

In my if statement I am trying to say, "if there is a space in strlen subtract that space then print strlen." My goal is to count only the letters that appear in the string and not the ...
0
votes
1answer
19 views

Strlen function does not give the intended output

when I execute this code below with the text: hello world, the result is 5 characters. Why is that? #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { ...
1
vote
2answers
1k views

passing argument 1 of ‘strlen’ from incompatible pointer type

How to make this working? How to properly find the length of these 8 listings? Whenever I execute it gives me following error. *passing argument 1 of ‘strlen’ from incompatible pointer type * #...
0
votes
1answer
28 views

For loop stops when pulling chars from string (vigenere)

So I am using a for loop to pull the specific chars from the key string. Whenever I use a key with the letter "a" or "A", the loop stops. I am using the for loop to pull the char and index with a ...
1
vote
1answer
47 views

Pset2 - Vigenere - Encypts all variations of “barfoo” as “ca\…” (no case issues)

This is my first question on Stack Exchange. I had a few different issues with this problem but I felt I'd finally sorted them out until I ran into this. I've been working for a number of hours today ...
0
votes
1answer
70 views

pset 2 initials: trouble printing only first char and char after space

So here is my current approach. I'm struggling with printing only the first character and the first character after a space in the problem. I feel like I'm pretty close but can't seem to figure out ...
0
votes
1answer
110 views

pset2 vigenere cipher - Why did the program return the wrong output

When i tested the program using the keyword "BaZ" from cs50 submit. It received "BaRFoo" and returned "CaRGog" as an output instead of "CaQGon" string s; s=GetString(); string key; key=argv[1]; int a=...
0
votes
1answer
171 views

length of argv always change to 1?

why the length of argv changed here to 1 always in the last line ?? #include <cs50.h> #include <stdio.h> #include <string.h> #include <ctype.h> int main(int argc, string argv[...
0
votes
1answer
387 views

Got an expected expression error on strlen ( values[] )

I'm working on CS50 pset3 helpers.c, trying to implement my own search algorithm (first TODO in the helpers) like the following: Make helpers came back with the following error message. Values[] is ...
1
vote
2answers
2k views

GetString() giving me a segfault in C

I am running a program in C using a GetString function (not from the CS50 library). When I run the program I get a segmentation fault error. In GDB, when I backtrace it tells me: Program received ...