Questions tagged [c]
C is a general-purpose programming language used for system programming (OS and embedded), libraries, games and cross-platform. This tag should be used with general questions concerning the C language, as defined in the ISO 9899 standard (the latest version, 9899:2018, unless otherwise specified — also tag version-specific requests with c89, c99, c11, etc). C is distinct from C++ and it should not be combined with the C++ tag absent a rational reason.
383,865
questions
0
votes
0
answers
9
views
C, gtk: ‘window’ undeclared (first use in this function)
I'm very new in C, i've started learning this language about 1 week ago, coming from Python. So,I have difficult understanding the C syntax, and the solution online. I'm trying building a simple ...
0
votes
0
answers
20
views
value inside a linked lists Node exists after change, why?
lets say we have a linked list = [1] -> [2] -> [3] -> [4]
typedef struct Node
{
int val;
struct Node* next;
}Node;
I have the head and to free all the allocated memory I do
printf(&...
-1
votes
0
answers
29
views
Fortran/C Unformatted Binary File on Windows/iOS
I have a fortran program that I used f2c to convert to C because I need to run it on iOS so this would be my only option. The program relies on file reading and writing, specifically it generates an ...
0
votes
1
answer
32
views
C: how stack array with variable size works and result is correct? What happened in memory?
I am confused why following code works and result is correct,
int size = 5;
int array[size];
I remember that stack array CANNOT assign its size by variable(except const), because variable only know ...
-4
votes
0
answers
20
views
.C isn't running in my multiple files project
im fairly new to programming and im trying to run the getCardHolderName function.
side node : I don't have a main function
enter image description here
-3
votes
1
answer
24
views
How many bytes are copied when I use the strcpy function on a String of n characters?
for example,
char pass[0x10];
char str1[0x10] = "hello";
strcpy(string1, str1)
Does this copy 1 * 5 bytes, plus 1 more bytes of the \0 null terminator?
So 6?
Im pretty new to low level, so ...
-2
votes
0
answers
35
views
My C String is returning numbers instead of characters, but only some of the characters, changes with every compilation [closed]
I have the following code:
int main(int argc, const char * argv[]) {
char bigString1[] = "hello this is big string";
}
Now in the debugger, when I do:
po bigString1[0]
I get "h&...
-1
votes
0
answers
25
views
32bit Assembly Program undefined reference to `printf'
I am testing assembly program and calling printf function from the assembly program and I kept on getting following error:
hello_world.o: In function `main':
hello_world.c:(.text+0x11): undefined ...
-4
votes
0
answers
31
views
Pattern programing in python [closed]
I have been trying for a long time but failing to make a code for it. Please share a code for the above pattern because I'm struggling to make it out.
543210
432101
321012
210123
101234
012345
0
votes
1
answer
21
views
Append and then insert an element in array in the same program
I want to append and then insert an element in an array. Append() function is appending an element at the last index. After that, I want to insert another element in array at a particular position. ...
0
votes
1
answer
27
views
Language: C How do I get my code to only print a message when the inputted text from the user meets a certain criteria?
I have 2 problems. One problem is the fact that in my for-loop I just used a constant, 3. This is fine for this specific program, though if I were to add more names in the future I would be required ...
0
votes
2
answers
55
views
Pointers in a function C language
Hello i am new to C language and trying to understand pointers.
Doing some examples i stumbled with this function and im not completely sure what it is about.
void dump(void *p, int n)
{
unsigned ...
0
votes
0
answers
26
views
Weird characters in stdout buffer. Prepended by zsh shell
What I am trying to do is to create and run a pseudo-terminal with it's output redirected to a pipe. The issue is that zsh (or any shell for that matter) outputs with a bunch of characters that I ...
0
votes
0
answers
24
views
Linux Driver Programming: Problem with usb_control_msg
Short Version
I want to write a Linux Driver for a custom USB device. Before writing the driver I used libusb-1.0 to test the device. With the following function call, I could read out a uin16_t value ...
0
votes
0
answers
17
views
insufficient space for an object of type 'char' C and heap buffer overflow error
i encounter this error when trying to run the following function in leetcode. but when ran on VSC with my own main function it works perfectly fine.
Line 15: Char 28: runtime error: store to address ...