Skip to main content
2 votes
3 answers
276 views

Given this function: int f() {return 10;} void(f()) defines a void f() and doesn't compile with the following error: 'void f(void)': overloaded function differs only by return type from 'int f(void)'...
Bagheri's user avatar
  • 39
0 votes
0 answers
100 views

I want to write a declaration, templated on a type, such that: If not instantiated, triggers no compiler warnings or errors, even with strict warning flags. If instantiated (e.g. by being used), ...
einpoklum's user avatar
  • 137k
5 votes
1 answer
173 views

Can function declaration in a function scope have a locally defined constant as default argument? For example, void f(int) {} int main() { constexpr int c = 1; void f(int = c); f(); } ...
Fedor's user avatar
  • 24.7k
0 votes
3 answers
144 views

In the 9th edition of Deitel's book C. How to program (chap. 7), a function is declared as void bubbleSort(int * const array, size_t size) and in the text it's specified that "function ...
Pinuz's user avatar
  • 3
4 votes
6 answers
273 views

So my professor gave us the assignment to code a function that works exactly like strcmp() but without using any library functions. I came up with the following code but instead of returning 1 or -1 ...
Nebelmonster's user avatar
0 votes
2 answers
97 views

//my_struct.h typedef struct my_struct_t *my_handle; void f1(my_handle handle); void f2(my_handle handle); //my_struct.c #include "my_struct.h" typedef struct { int a; int b; } ...
Parminder Singh's user avatar
0 votes
2 answers
94 views

I would like to use values within variables for defining functions in R. However, after declaring the function I can still see the variable names instead of their values inside the function definition....
Imsa's user avatar
  • 199
0 votes
0 answers
129 views

#include <vector> #include <queue> #include <functional> using namespace std; int main() { priority_queue< int, vector<int>, auto(*)(int, int)->bool > que1; ...
iouvxz's user avatar
  • 175
4 votes
2 answers
141 views

There are (source): void f(); // declaration (1) void f(void); // declaration with prototype (2) void f() { ... } // definition (3) void f(void) { ... } // definition with ...
Sinatr's user avatar
  • 22.3k
-4 votes
2 answers
97 views

Suppose I have a function: void function(int a[3]) {/*..*/} What is the efficient way of calling this function with values in place I want to calling as below without creating a new local array[3] ...
Raja Sekhar B's user avatar
2 votes
3 answers
98 views

I am hoping to get some help with understanding why function definitions, with function pointer return types need to be written the following way. int ( * functionFactory (int n) ) (int, int) { ...
Tim's user avatar
  • 169
1 vote
3 answers
145 views

Consider this C code: _Noreturn void exit(int status); void exit(int status); int main(void) { exit(0); } It declares the exit function twice, once with the _Noreturn function specifier, and ...
Joseph Sible-Reinstate Monica's user avatar
5 votes
2 answers
187 views

Is the following a standard C function declaration according to ISO/IEC 9899:2017 (c17)? int foo(int (bar), int (baz)); If so, please point me to the section in the standard that defines this. In ...
GandhiGandhi's user avatar
  • 1,573
2 votes
4 answers
405 views

I have two source files, main.cpp and math.cpp, along with a header file math.h. The code is as follows: // main.cpp #include "math.h" #include <iostream> int main() { std::cout &...
utg.tdawg's user avatar
  • 358
2 votes
1 answer
157 views

INTRO I am writing a class stalker<Obj> that holds inside a variable of type Obj. I want that stalker<Obj> to pretend that it is almost the same as Obj variable (from the user's ...
Alexander S's user avatar

15 30 50 per page
1
2 3 4 5
34