Skip to main content
0 votes
1 answer
76 views

I'm using a Azure IoT Hub to send and receive messages to and from a device. To do this, I'm utilizing a library written in C and my application is written in C++. When I convert my std::string to a ...
Nils Rasmussen's user avatar
0 votes
0 answers
35 views

im trying to run this code #include <stdio.h> #include <string.h> #if defined(_WIN32) #define SEPERATOR '\\' #elif defined(__unix__) || defined(__linux__) #define SEPERATOR '/' #endif ...
neo's user avatar
  • 47
3 votes
4 answers
132 views

I am attempting to develop a method to customize strcpy. I considered two approaches for this implementation. One method involves using memcpy, while the other involves incrementing the pointer and ...
Vishnu CS's user avatar
  • 853
2 votes
3 answers
401 views

I am trying to concatenate string-like objects at compile-time. With the help of this post, I came up with something like this: #include <cstddef> #include <utility> #include <algorithm&...
lobelk's user avatar
  • 531
0 votes
1 answer
112 views

I am building a command line parser in C, where I take a command line input and organize it into a struct pipeline. The struct has a commands member that contains a struct that has the first command, ...
Howell X's user avatar
0 votes
0 answers
60 views

I'm assuming this is undefined behavior, but I'm not exactly sure why? When I compile the above code with g++ 4.4.7 and execute it: #include <iostream> #include <string> using namespace ...
MrMiserMeister's user avatar
1 vote
2 answers
103 views

I read that while using character pointer declaration first the string literal is getting stored in static storage and then pointer to it is returned. but is same happening while using literals in ...
Aka's user avatar
  • 55
1 vote
0 answers
226 views

EDIT: To summarize from the comments (before I close the topic): the issue has been discussed here previously: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0487r1.html The resolution ...
Martin Weitzel's user avatar
0 votes
5 answers
246 views

This is what I expect my string array s to be after the program is run: {"#0", "#1", "2"}. This is what I am getting: {"#2", "#2", "2"}. How ...
Unyaya's user avatar
  • 66
-1 votes
1 answer
2k views

I require to build a simple Arduino function that returns either "char*" or "const char*" type and then I need to print that value. However, I'm facing a problem: when I try to ...
Juan_David's user avatar
0 votes
2 answers
57 views

I am writing a C function GetDeviceList() which must return a list of device names found as strings somehow. The number of devices found and of course the device names themselves will vary each time ...
Engineer999's user avatar
  • 4,159
2 votes
4 answers
1k views

As far as I know, a string literal can't be modified for example: char* a = "abc"; a[0] = 'c'; That would not work since string literal is read-only. I can only modify it if: char a[] = &...
HDHDHD's user avatar
  • 31
1 vote
1 answer
207 views

hope you are well. I recently started learning ADT (Abstract Data Type) in college, and I have an assignment that states the following: Complete ADTDate adding the following primitive function: void ...
Frank S.'s user avatar
0 votes
1 answer
57 views

Whenever I create a char* with malloc(), the first few bytes get random data, which is different every time I compile the code. In this case, I wanted to concatenate 2 char* to create 1 char*. char *...
Filip's user avatar
  • 5
3 votes
2 answers
420 views

Currently reading K&R and just got stumbled across the char pointers. There's nothing about memory allocation when defining char pointers in the book rn, maybe it'll be explained later. But it ...
かわいそu's user avatar

15 30 50 per page
1
2 3 4 5
12