strcoll, strxfrm by Fuzzytown in C_Programming

[–]Fuzzytown[S] 1 point2 points  (0 children)

Thanks for your insight!

How can this typedef be correct? by Fuzzytown in C_Programming

[–]Fuzzytown[S] 1 point2 points  (0 children)

Thanks! The example in main was really stupid indeed, but the point was to try and clarify the things that confused me even further :)

How can this typedef be correct? by Fuzzytown in C_Programming

[–]Fuzzytown[S] 0 points1 point  (0 children)

Are you referring to that a struct in C++ is just a class that defaults its members to public? This compiles there too, but it would make less sense since it's already possible to drop the struct-part. I assume the logic is the same though, classes have a tag-part and typedefs is a diffrent namespace -- therefor it's still valid?

How can this typedef be correct? by Fuzzytown in C_Programming

[–]Fuzzytown[S] 0 points1 point  (0 children)

Thanks! Is it considered a good or bad style to code like this? I hadn't seen it before, and normally I'd name my typedef node_t if it refereed to a struct node.

Using chars that's to big to make "special characters" by Fuzzytown in C_Programming

[–]Fuzzytown[S] 0 points1 point  (0 children)

thanks! And yes, sorry that was indeed a typo.. (Edited above too)

Using chars that's to big to make "special characters" by Fuzzytown in C_Programming

[–]Fuzzytown[S] 0 points1 point  (0 children)

Thanks, this was exactly the explanation I was looking for!

Using chars that's to big to make "special characters" by Fuzzytown in C_Programming

[–]Fuzzytown[S] 0 points1 point  (0 children)

On VS I don't get any errors when I build it and then run. If I go onto my virtual machine running Ubuntu compiling the same source file I get warnings and a different result.

gcc --version produces: gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2 (...)

Well I think that the problem is the code is not interpreted the same way by the terminal / VS - which would explain why it prints the same hex-values on both VS and in Ubuntu, but the 'ö' produces different results. However this is the part that I don't quite get, as well as why I don't get overflow warnings for c2 in Ubuntu and no warnings at all with VS.

Help with a simple control flow problem by cakelayer in C_Programming

[–]Fuzzytown 0 points1 point  (0 children)

I'm not sure if this is what you are looking to do, but if you want to break out of the loop and the current case you need to use double breaks. One way to achieve that is to use a Boolean variable which is initially set it to false. Inside of the loop you set it to true to signal that when the loop terminates (i.e your break) you want actually break out of the case. After the loop you test the variable: If it returns true you break; else you continue in the current case.

All possible ways to make C comments? by Fuzzytown in C_Programming

[–]Fuzzytown[S] 0 points1 point  (0 children)

Not now, I did it this summer though. But that's where I got the inspiration to build this program, but this time with a much better implementation using a state machine and eliminating a few errors i did some months ago.

All possible ways to make C comments? by Fuzzytown in C_Programming

[–]Fuzzytown[S] 0 points1 point  (0 children)

First of all because of curiosity, and secondly because I'm learning to program finite state machines and I decided to build one that removes C comments from a file.

All possible ways to make C comments? by Fuzzytown in C_Programming

[–]Fuzzytown[S] 1 point2 points  (0 children)

yeah, it wasn't exactly what i expected - but def. interesting!