The output of the following program:
int main(){
int x = "test";
int y = "test";
printf("%u %u\n",x,y);
return 0;
Type: Posts; User: envec83
The output of the following program:
int main(){
int x = "test";
int y = "test";
printf("%u %u\n",x,y);
return 0;
Optimial topoligical sorting algorithms run indeed in linear time pretty much. However, I coded my own solution, which is sub-optimal and run in nē time. I basically create an adjacency matrix and...
I am working on a program to make topological sorts, but depending on size of the dataset given the time to compute everything is too large.
I want to add a command to my program to make it track...
Gotcha. Thanks guys.
I believe I understand how normal variables and pointers are represented in memory.
For example, it's easy to understand that a pointer Ptr will have one address, and its value will be a...
This makes things better indeed. Thanks
I need to code a small/simple database application using C.
My idea is to use a B-Tree to store the items of each table. The problem I am facing is that tables need to be flexible to hold an...
As you probably know, there used to be an "International Obfuscated C Code Contest", where the goal was to explore the subtleties of the C language by seeing who could write the most obfuscated code....
Ops. Sorry about that.
Just to help other people coming to this thread, yeah it seems that what I asked is indeed undefined behavior.
The output of the following code:
x = 10;
x = x++;
printf("%d\n",x);
is 11.
What is not clear to me is: does the increment on x happen before or after the attribution? And is this...
That fixed it.
Thanks a lot.
I need to read a file via stdin (so I'll run my program as ./program <input.txt> output.txt) but I am having problems doing so correctly. The input file starts with an integer x, and x lines follow....
@iMalc, good points, and it made things more clear.
Thanks.
Curiously the trick works when using ANSI standard as well.
But yeah doesn't work when the array is not last member.
Hi,
I just learned that it's possible to increase the size of the memory you'll allocate to a struct when using the malloc function. For example, you can have a struct like this:
struct test{...
Worked like a charm. I forget scanf returns the number of items successful matched.
Thanks a lot.
Hi,
My program needs to read input from a file called file.in, and I need to do it by adding the file as an argument when running the program. So I run it like this:
./myProgram <file.in>...
Gotcha now.
Thanks
The fact that you should not include libraries you don't need is pretty obvious to me.
What I am asking is where to place the ones you do need, because there are several ways to do it (I mentioned...
I don't mean that, and yeah I know that you shouldn't put function calls or definitions inside a header file. If you read my first post you'll notice that I said functions go inside the functions.c...
Suppose I am working on a program with 3 files:
Main.c (main file which runs the program)
Functions.c (collection of functions used by main.c)
MyHeader.h (list of function prototypes,...
Thanks. I suspected, but better to cross check with the pros.
I am learning how to use malloc, and I am seeing that most people think it's necessary to make a type cast when passing the memory address to the pointer. For example, here's a code to get 16 new...
I did read the documentation as stated in my first post, but I couldn't figure out how to apply that.
I managed to install the library using the Synaptics manager.
Thanks anyway.
First of all sorry for the newbie question, but here we go:
I am trying to install the GMP (GNU Multiple Precision Arithmetic) Library on my Ubuntu machine.
I downloaded the .tar.bz2 file, and...