c Questions

3

I'm trying to implement merge sort but somehow have been stuck for a day. [Sorry for pasting a big amount of code but wouldn't be able to do without it] Implementation: Merge Sort - Function int me...
Tuberculous asked 3/9, 2013 at 20:53

6

Solved

In C a floor division can be done, eg: int floor_div(int a, int b) { int d = a / b; if (a < 0 != b < 0) { /* negative output (check inputs since 'd' isn't floored) */ if (d * a != b) { /*...
Grabble asked 17/9, 2017 at 14:53

2

Solved

Do there exist intrinsics for ARM C compilers to do add-with-carry operations, or is it necessary to use assembly language? On x86, there is _addcarry_u64 for add-with-carry. (There's also the new...
Nobel asked 9/5, 2016 at 23:21

7

Solved

In the book "The C Programming Language" it says: "Many of the functions in the library set status indicators when error or end of file occur. These indicators may be set and tested explicitly....
Reinold asked 12/7, 2009 at 18:23

7

Solved

Let's say I have a pointer allocated to hold 4096 bytes. How would one deallocate the last 1024 bytes in C? What about in C++? What if, instead, I wanted to deallocate the first 1024 bytes, and kee...
Absorbing asked 20/8, 2009 at 8:29

2

Solved

I'm trying to compile something that depends on gtkspell, which depends on enchant, under MinGW. I'm getting errors like gtkspell/gtkspell.c:757: undefined reference to '_imp__enchant_broker_init'...
Traver asked 7/4, 2012 at 23:28

2

I want to detect if an address is temporary ipv6 address, i using getifaddrs to get the list of addresses but don't know how to get that info from there. And if possible i want that to work for lin...
Fellah asked 24/7, 2013 at 12:14

4

Solved

In C I can initialize an array on the stack like so: SOME_DATA_TYPE* x = (SOME_DATA_TYPE[5]) {v1, v2, v3, v4, v5}; Is there a similar one-line method to assign values to a malloc()-ed array on t...
Houri asked 27/7, 2016 at 19:15

2

Solved

I have this code: #include <stdio.h> #include "SDL/SDL.h" SDL_Surface *screen = NULL; int main(int argc, char* args[]) { SDL_Init(SDL_INIT_EVERYTHING); screen = SDL_SetVideoMode(640, 4...
Guideboard asked 2/7, 2013 at 20:16

3

Solved

I want to get the address of _GLOBAL_OFFSET_TABLE_ in my program. One way is to use the nm command in Linux, maybe redirect the output to a file and parse that file to get address of _GLOBAL_OFFSET...
Onceover asked 13/3, 2012 at 15:11

8

i know c and I want to develop applications with GUI for Mac OS. Where do I start?
Combustible asked 30/3, 2010 at 14:29

13

I need an efficient way to select 2 largest integers from an array of 4, preserving the order. E.g. 1,4,3,5 -> 4,5; 1,5,3,4 -> 5,4 What's the efficient way to do it (C/C++)? I.e., with minimu...
Photographic asked 6/8, 2024 at 14:14

5

Solved

How to read the metadata of a MKV movie files in C# (or C or C++ or AS3)? for example such creator metadatacreator hasKeyframes hasVideo hasAudio hasMetaData canSeekToEnd duration datasize videos...
Estebanesteem asked 5/1, 2010 at 4:46

3

Solved

I looked up the manual of iso_8859-1 and found the degree symbol: Oct Dec Hex Char Description 260 176 B0 ° DEGREE SIGN Code: int main( int argc, char *argv[]) { char chr = 176; //stores the e...
Biathlon asked 17/10, 2015 at 15:2

11

Solved

Wikipedia says it's called a quine and someone gave the code below: char*s="char*s=%c%s%c;main(){printf(s,34,s,34);}";main(){printf(s,34,s,34);} But, obviously you have to add #include <stdi...
Eidson asked 20/4, 2012 at 0:23

6

Solved

Everytime I compile and run c file, I have to type: gcc filename.c a.out I don't want to do this in two lines, How to compile and run in one line on linux terminal?
Ninfaningal asked 25/1, 2017 at 19:48

3

I was looking at the format specifiers and noticed that %n and %t were listed as valid specifiers. According to the documentation, the insert a new line and a horizontal tab character, respectively...
Piliform asked 8/8, 2024 at 8:2

4

Solved

Are there any known false positives with Valgrind? I get a 'Conditional jump or move depends on uninitialised value(s)' with the fmemopen function, writing in C and compiling with GCC. Can I be sur...
Satyr asked 28/4, 2009 at 7:19

15

Solved

I need to write a function that will count words in a string. For the purpose of this assignment, a "word" is defined to be a sequence of non-null, non-whitespace characters, separated fr...
Riproaring asked 2/10, 2012 at 21:44

8

I'm trying to read a line using the following code: while(fscanf(f, "%[^\n\r]s", cLine) != EOF ) { /* do something with cLine */ } But somehow I get only the first line every time. Is this a ba...
Asbestosis asked 14/5, 2009 at 6:12

3

Solved

There are many questions on this site regarding Unicode and wchar_t. I guess I have grasped the concept, but then found something that proves most (if not all) answers wrong if it is true. On this ...
Item asked 5/8, 2024 at 17:40

1

Solved

Recently we switched to a more recent GCC and it optimized away a whole function and replaced it with "null pointer access" trap code instead when optimizing for size. Looking at godbolt,...
Schnook asked 5/8, 2024 at 14:3

3

I have this simple hello world program: #include <stdio.h> int main() { printf("Hello, world!\n"); return 0; } I compiled this program with LLVM Clang (v15.0.1, built from Homeb...
Equipment asked 28/1, 2023 at 1:33

6

Solved

I read here it is C90 with extensions. How can I know for sure?
Wellhead asked 17/9, 2011 at 22:45

4

Solved

When a process runs out of file descriptors, accept() will fail and set errno to EMFILE. However the underlying connection that would have been accepted are not closed, so there appears to be no wa...
Paly asked 8/11, 2017 at 12:29

© 2022 - 2025 — McMap. All rights reserved.