Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 7308

C is a general-purpose computer programming language used for operating systems, games, and other high performance work and is clearly distinct from C++. It was developed in 1972 by Dennis Ritchie for use with the Unix operating system.

5 votes
Accepted

C Split function review

It's been a few years since I used C on a regular basis, and even at my peak with C, I was never very familiar with the standard or certain best practices. … code is taking that strtok functionality and using it to push things into an array What you have now will (probably) perform better than strtok I'm not familiar enough with standard practices of C
Corbin's user avatar
  • 10.6k
2 votes

c code emulating grep

Yuushi covered pretty much everything, but a few more minor things stood out to me. I'm not a fan of the overuse of MAX_FILE_LENGTH. When you're setting up automatic duration buffers, sure, use MA …
Corbin's user avatar
  • 10.6k
7 votes
Accepted

Managing a user account

In C++, there is indeed a subtle but potentially important difference: return will have local objects destruct; exit will not. Your indentation is all kinds of crazy. … A large part of this opinion comes down to me being lazy with arguably bad habits :). 100% opinion: If you're going the Visual Studio route, I'd go with C++, not C. …
Corbin's user avatar
  • 10.6k
12 votes

Summing user input

Just one of the many gotchas in C with regards to portability if you're ever going to experience a truly rare environment.) I don't understand why the array and sum are unsigned. …
Corbin's user avatar
  • 10.6k
9 votes
Accepted

Function to return last line's length of a string

If it matters, it also tends to be pretty rare style wise in C. You should probably explicitly document what happens if a line break is not found in the text. …
Corbin's user avatar
  • 10.6k
6 votes

Lexical analyzer for a programming language

When possible, avoid non-standard parts of C. … In particular, conio.h is going to tie you to very specific environments (in particular, Windows with either Turbo C compiler or Microsoft's Visual Studio's C compiler). clrscr is probably not worth tying …
Corbin's user avatar
  • 10.6k
4 votes
Accepted

Life, the Universe, and Everything

Assuming SPOJ is like other online judges, you need to work on a line basis. If you just output undelimited integers, how can the judge tell if 111 is 1, 11, 11, 1 or 111? This is meant to just be an …
Corbin's user avatar
  • 10.6k
4 votes

Converting from base-10 to word

Typedef I like to avoid typedefs without semantic meaning. In other words, ull is just a shortcut for unsigned long long, not a meaningful type. I'm assuming you care you about the maximum value mo …
Corbin's user avatar
  • 10.6k
4 votes

C Doubly Linked List

Though it's not worth worrying about it unless you're working on non-trivial C programs or developing a library others will use, you should be mindful of potential name collisions and use a prefix. …
Corbin's user avatar
  • 10.6k
3 votes

Managing a bit array

Unless I'm misreading something (and there's a very good chance that I am), there's quite a nasty overflow: void BAL_And(BAL_Array *p, BAL_Array *q) { assert(p != NULL); assert(q != NULL); …
Corbin's user avatar
  • 10.6k
1 vote

Custom strcat() with different arguments

This means that a cannot be changed (a = b; and a = &c; are invalid), but the contents of a can be (a[3] = 'b'; is valid). const char* const a; "a is a constant pointer to a constant char." …
Corbin's user avatar
  • 10.6k
4 votes
Accepted

C inner product function without using array subscripting

I have a few comments on style. (By which I really mean, 100% opinion... :D) One declaration per line A lot of people strongly disagree with this, but I find it much easier to read code that has …
Corbin's user avatar
  • 10.6k
3 votes
Accepted

Another stack implementation (in C)

It's good overall, but I do have a few suggestions. (Looks like William Morris beat me to a few of these, but there's a few different ones too :p.) Rather than using the top node as the container, …
Corbin's user avatar
  • 10.6k
18 votes

Temperature conversion in C

It's also fairly common to use PascalCase for structs in C. Rather than celsconv, I would state what the conversion is from and to. For example, fahrenheit_to_celsius and celsius_to_fahrenheit. … not a concern (it's not in a tight loop for example), I would be tempted to use tolower (from ctype.h) to simplify the switch to only have 1 case per character: switch (tolower(choice)) { case 'c' …
Corbin's user avatar
  • 10.6k
3 votes
Accepted

Review implementation of stack by using pointers in C

Declarations go in a header file (.h), and definitions go in a source file (.c). Consuming code then includes the header and doens't have to even know the source file exists. … Ideally they'd be part of the actual type of the object (looks longingly at C++). …
Corbin's user avatar
  • 10.6k

15 30 50 per page