Skip to main content
41 votes
5 answers
7k views

I'm currently reading "Expert C Programming - Deep C Secrets", and just came across this: The storage class specifier auto is never needed. It is mostly meaningful to a compiler-writer ...
Chi_Iroh's user avatar
  • 1,169
0 votes
1 answer
68 views

When I use a pointer instead of referencing operator in a function pointer do not allow auto variable to get deleted after function call. I got Segmentation fault (core dumped) from this code because ...
A_normal_guy's user avatar
1 vote
1 answer
132 views

I'm writing an API that has structs such as struct datast{ int a; int *items; size_t numitems; }; I'm providing functions which free the contents of such structs (in a similar fashion to what C++ ...
cesss's user avatar
  • 913
0 votes
2 answers
363 views

void func() { const int intAge = 24; } What happens with intAge after you run func()? Do you have to deallocate it, or does the C++ compiler do this?
olemca's user avatar
  • 19
0 votes
3 answers
260 views

In a C99 program, under the (theoretical) assumption that I'm not using variable-length arrays, and each of my automatic variables can only exist once at a time in the whole stack (by forbidding ...
Eric's user avatar
  • 703
2 votes
3 answers
248 views

Supose this C code: int main(){ int n; scanf("%d\n", &n); int a[n]; int i; for (i = 0; i<n; i++){ a[i] = 1; } } We have a vector which is in ...
isma's user avatar
  • 153
0 votes
1 answer
147 views

I am currently on a demographic project. I have data from 3 different countries and their birth statistics in each month. My question: I want to calculate the percentage people born in each month and ...
alexryder's user avatar
44 votes
3 answers
3k views

Consider the following snippet: #include <array> int main() { using huge_type = std::array<char, 20*1024*1024>; huge_type t; } Obviously it would crash on most of platforms, because ...
Igor R.'s user avatar
  • 15.1k
0 votes
2 answers
127 views

Assume I have a structure like this in a C program: if (res == NULL) { int i = 1; ... } else { int i = 2; ... } Will I save some amount of memory if I instead write int i; if (res ==...
apadana's user avatar
  • 732
0 votes
0 answers
123 views

I have a folder with 5 files. One of the files has an email address. I want to extract the email address from the file first, map it to a database, and then store it somewhere as a variable so that it ...
Zuhair Ahmed 's user avatar
0 votes
1 answer
58 views

I have a Debian server and I wish to "save" some files automatically and send them automatically to a googledrive. this automatic task must be done regularly (every week, for example)
Ian's user avatar
  • 9
5 votes
2 answers
1k views

Some of this may be a duplicate, but I am sorry for that. Let's say I have this struct: struct foo { int a; int b; int c; }; 1. If struct foo type object is declared in the way that it ...
Karolis Milieška's user avatar
2 votes
2 answers
1k views

I am looking for a VB script or batch file to read & Execute multiple URLs from an CSV file containing the URL Data in column B & The mentioned URL directly contains on the downloadable file ...
mr.cooldeath's user avatar
1 vote
2 answers
104 views

I'm currently studying variable length array and automatic storage. I have the following code that allocate memory for an variable length array myArray inside function vla, and return a pointer to ...
Thor's user avatar
  • 10.1k
3 votes
3 answers
119 views

Consider the following code: void func() { int p; ... if (p > MAX) { struct my_struct s; ... /* here we access the contents 's' as '&s' */ } } In this snippet ...
Mark's user avatar
  • 6,604

15 30 50 per page