RSS

Posts in 2021

  • Most votes on c++ questions 2

    May 01, 2021 in FAQ

    Most votes on c++ questions 2. #11 What is the difference between const int*, const int * const, and int const *? #12 How do function pointers in C work? #13 What does "static" mean in C? #14 How do I determine the size of my array in C? #15 How do I use extern to share variables between source files? #16 Why does the C preprocessor interpret the word "linux" as the constant "1"? #17 How to initialize all members of an array to the same value? #18 Obfuscated C Code Contest 2006. Please explain sykes2.c #19 What is the difference between ++i and i++? #20 What is the difference between a definition and a declaration?

    Read all the top votes questions and answers in a single page. #11: What is the difference between const int*, const int * const, and int const *? (Score: 1501) Created: 2009-07-17 Last updated: 2020-12-19 Tags: c++, c, pointers, constants, c++-faq I …

    Read more

  • Most votes on c++ questions 10

    May 01, 2021 in FAQ

    Most votes on c++ questions 10. #91 Is Fortran easier to optimize than C for heavy calculations? #92 How do you get assembler output from C/C++ source in gcc? #93 What is array to pointer decay? #94 Is It Possible to NSLog C Structs (Like CGRect or CGPoint)? #95 Which is better option to use for dividing an integer number by 2? #96 How can I get a file's size in C? #97 How do I print the full value of a long string in gdb? #98 How dangerous is it to compare floating point values? #99 How do you format an unsigned long long int using printf? #100 Fastest way to determine if an integer is between two integers (inclusive) with known sets of values

    Read all the top votes questions and answers in a single page. #91: Is Fortran easier to optimize than C for heavy calculations? (Score: 422) Created: 2008-09-28 Last updated: 2018-01-28 Tags: c, performance, fortran From time to time I read that …

    Read more

  • Most votes on c++ questions 1

    May 01, 2021 in FAQ

    Most votes on c++ questions 1. #1 What is the "–>" operator in C/C++? #2 Improve INSERT-per-second performance of SQLite #3 How do you set, clear, and toggle a single bit? #4 What is the difference between #include <filename> and #include "filename"? #5 Do I cast the result of malloc? #6 What does the ??!??! operator do in C? #7 What is the effect of extern "C" in C++? #8 What is ":-!!" in C code? #9 With arrays, why is it the case that a[5] == 5[a]? #10 Compiling an application for use in highly radioactive environments

    Read all the top votes questions and answers in a single page. #1: What is the "–>" operator in C/C++? (Score: 9377) Created: 2009-10-29 Last updated: 2021-02-11 Tags: c++, c, operators, code-formatting, standards-compliance After …

    Read more

  • Most votes on c questions 9

    May 01, 2021 in FAQ

    Most votes on c questions 9. #81 Is there a standard sign function (signum, sgn) in C/C++? #82 Why should we typedef a struct so often in C? #83 How to allocate aligned memory only using the standard library? #84 How can one print a size_t variable portably using the printf family? #85 Undefined reference to pthread_create in Linux #86 Difference between a Structure and a Union #87 Why is the use of alloca() not considered good practice? #88 Why do all the C files written by my lecturer start with a single # on the first line? #89 Static linking vs dynamic linking #90 How does free know how much to free?

    Read all the top votes questions and answers in a single page. #81: Is there a standard sign function (signum, sgn) in C/C++? (Score: 446) Created: 2009-12-14 Last updated: 2009-12-24 Tags: c++, c, math I want a function that returns -1 for negative …

    Read more

  • Most votes on c questions 8

    May 01, 2021 in FAQ

    Most votes on c questions 8. #71 What's the best way to check if a file exists in C? #72 Is there a printf converter to print in binary format? #73 What are .a and .so files? #74 Convert char to int in C and C++ #75 What is Linux’s native GUI API? #76 Why is volatile needed in C? #77 Why are hexadecimal numbers prefixed with 0x? #78 How many levels of pointers can we have? #79 What is the difference between float and double? #80 What are the barriers to understanding pointers and what can be done to overcome them?

    Read all the top votes questions and answers in a single page. #71: What's the best way to check if a file exists in C? (Score: 481) Created: 2008-10-23 Last updated: 2019-02-22 Tags: c, filesystems, cross-platform Is there a better way than simply …

    Read more

  • Most votes on c questions 7

    May 01, 2021 in FAQ

    Most votes on c questions 7. #61 How would one write object-oriented code in C? #62 How to initialize a struct in accordance with C programming language standards #63 Programmatically find the number of cores on a machine #64 When is assembly faster than C? #65 What is an unsigned char? #66 Is there a performance difference between i++ and ++i in C? #67 Typedef function pointer? #68 Debug vs Release in CMake #69 Preventing console window from closing on Visual Studio C/C++ Console application #70 C pointer to array/array of pointers disambiguation

    Read all the top votes questions and answers in a single page. #61: How would one write object-oriented code in C? (Score: 514) Created: 2008-12-09 Last updated: 2019-12-30 Tags: c, oop, object What are some ways to write object-oriented code in C? …

    Read more

  • Most votes on c questions 6

    May 01, 2021 in FAQ

    Most votes on c questions 6. #51 Why are #ifndef and #define used in C++ header files? #52 Calling C/C++ from Python? #53 What is the printf format specifier for bool? #54 What is the difference between char s[] and char *s? #55 What is the argument for printf that formats a long? #56 How do I list the symbols in a .so file #57 Correct format specifier for double in printf #58 Why does sizeof(x++) not increment x? #59 Fastest way to check if a file exist using standard C++/C++11/C? #60 unsigned int vs. size_t

    Read all the top votes questions and answers in a single page. #51: Why are #ifndef and #define used in C++ header files? (Score: 557) Created: 2009-10-31 Last updated: 2019-07-25 Tags: c++, c, c-preprocessor I have been seeing code like this usually …

    Read more

  • Most votes on c questions 5

    May 01, 2021 in FAQ

    Most votes on c questions 5. #41 How to generate a random int in C? #42 Which is faster: while(1) or while(2)? #43 Difference between static and shared libraries? #44 makefile:4: *** missing separator. Stop #45 Why does ENOENT mean "No such file or directory"? #46 What does "dereferencing" a pointer mean? #47 Why does printf not flush after the call unless a newline is in the format string? #48 What REALLY happens when you don't free after malloc? #49 Undefined, unspecified and implementation-defined behavior #50 What is a "static" function in C?

    Read all the top votes questions and answers in a single page. #41: How to generate a random int in C? (Score: 599) Created: 2009-05-04 Last updated: 2018-07-14 Tags: c, random Is there a function to generate a random int number in C? Or will I have …

    Read more

  • Most votes on c questions 4

    May 01, 2021 in FAQ

    Most votes on c questions 4. #31 What is size_t in C? #32 Divide a number by 3 without using *, /, +, -, % operators #33 How do you pass a function as a parameter in C? #34 What is a segmentation fault? #35 Can code that is valid in both C and C++ produce different behavior when compiled in each language? #36 How do I detect unsigned integer multiply overflow? #37 How can I get the list of files in a directory using C or C++? #38 How to determine CPU and memory consumption from inside a process? #39 "static const" vs "#define" vs "enum" #40 Why is “while ( !feof (file) )” always wrong?

    Read all the top votes questions and answers in a single page. #31: What is size_t in C? (Score: 694) Created: 2010-03-31 Last updated: 2013-12-11 Tags: c, int, size-t I am getting confused with size_t in C. I know that it is returned by the sizeof …

    Read more

  • Most votes on c questions 3

    May 01, 2021 in FAQ

    Most votes on c questions 3. #21 typedef struct vs struct definitions #22 Unit Testing C Code #23 What is the strict aliasing rule? #24 Why are these constructs using pre and post-increment undefined behavior? #25 Why use apparently meaningless do-while and if-else statements in macros? #26 Difference between malloc and calloc? #27 Using boolean values in C #28 What should main() return in C and C++? #29 Why isn't sizeof for a struct equal to the sum of sizeof of each member? #30 Speed comparison with Project Euler: C vs Python vs Erlang vs Haskell

    Read all the top votes questions and answers in a single page. #21: typedef struct vs struct definitions (Score: 891) Created: 2009-11-04 Last updated: 2018-12-04 Tags: c, struct, typedef I’m a beginner in C programming, but I was wondering …

    Read more