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,863
questions
-1
votes
0
answers
22
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
28
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 ...
-1
votes
0
answers
16
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
18
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
31
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
21
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 ...
-3
votes
0
answers
28
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
20
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
52
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
23
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
22
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
15
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 ...
0
votes
2
answers
30
views
Creating a variable array of pointers
I have this piece of code from a program i am writing that doesn't work if i add a condition.
All the values are conveniently put based on those the original program would have.
I want to create an ...
0
votes
1
answer
29
views
Could not load... (error) in Problem set 5 of CS50 when check50
I'm at the problem set 5 of the CS50 course : speller. To solve this problem, we need basically to load a dictionary (already given by the staff members)into a hash table that we need to create. Then, ...