Languages Features Creators CSV Resources Challenges Add Language
GitHub icon

C

C - Programming language

< >

C is a programming language created in 1972 by Dennis Ritchie.

#3on PLDB 51Years Old 3.8mUsers
78Books 19Papers 2mRepos

Try now: Riju Ā· Replit

C (, as in the letter c) is a general-purpose, imperative computer programming language, supporting structured programming, lexical variable scope and recursion, while a static type system prevents many unintended operations. By design, C provides constructs that map efficiently to typical machine instructions, and therefore it has found lasting use in applications that had formerly been coded in assembly language, including operating systems, as well as various application software for computers ranging from supercomputers to embedded systems. C was originally developed by Dennis Ritchie between 1969 and 1973 at Bell Labs, and used to re-implement the Unix operating system. Read more on Wikipedia...


Example from Compiler Explorer:
// Type your code here, or load an example. int square(int num) { return num * num; }
Example from Riju:
#include <stdio.h> int main() { printf("Hello, world!\n"); return 0; }
Example from hello-world:
#include <stdio.h> main() { printf("Hello World\n"); }
Example from Linguist:
#ifndef HELLO_H #define HELLO_H void hello(); #endif
Example from Wikipedia:
#include <stdio.h> int main(void) { printf("hello, world\n"); }
C gets credit for the // comments, starting in 1972, but that's not really accurate. BCPL -- which begat B which begat C -- had // comments but they were not included in C until C99. C++ (which isn't included in their top 30 languages) brought back // comments from BCPL sometime between 1979 and 1985 (the first public release of cfront). Many C compilers included // comments as an extension prior to C99 but those were inspired by C++

Keywords in C

auto break case char const continue default do double else enum extern float for goto if int long register return short signed sizeof static struct switch typedef union unsigned void volatile while

Language features

Feature Supported Token Example
Scientific Notation āœ“
Conditionals āœ“
Constants āœ“
While Loops āœ“
Case Sensitivity āœ“
Assignment āœ“ =
Switch Statements āœ“
switch(expression) {
   case true  :
      break;
   default :
   //
   break;
}
Print() Debugging āœ“ printf
MultiLine Comments āœ“ /* */
/* A comment
*/
Line Comments āœ“ //
// A comment
Increment and decrement operators āœ“
Zero-based numbering āœ“
Variadic Functions āœ“
double average(int count, ...)
{
 //
}
Manual Memory Management āœ“
#include 
#include 
int main(void)
{
  int *poin = malloc(4);
  free(poin);
}
Macros āœ“
// https://learn.microsoft.com/en-us/cpp/preprocessor/macros-c-cpp?redirectedfrom=MSDN&view=msvc-170
// https://gcc.gnu.org/onlinedocs/cpp/Macro-Arguments.html
#define min(X, Y)  ((X) < (Y) ? (X) : (Y))
  x = min(a, b);          →  x = ((a) < (b) ? (a) : (b));
  y = min(1, 2);          →  y = ((1) < (2) ? (1) : (2));
  z = min(a + 28, *p);    →  z = ((a + 28) < (*p) ? (a + 28) : (*p));
Integers āœ“
int pldb = 80766866;
File Imports āœ“
//  If a header file is included within <>, the preprocessor will search a predetermined directory path to locate the header file. If the header file is enclosed in "", the preprocessor will look for the header file in the same directory as the source file.
#include 
#include "stdio.h"
Type Casting āœ“
double da = 3.3;
double db = 3.3;
double dc = 3.4;
int result = (int)da + (int)db + (int)dc; //result == 9
Directives āœ“
#include 
#define height 10
#ifdef
#endif
#if
#else
#ifndef
#undef
#pragma
Gotos āœ“
// C/C++ program to check if a number is 
// even or not using goto statement 
#include  
using namespace std; 
  
// function to check even or not 
void checkEvenOrNot(int num) 
{ 
    if (num % 2 == 0) 
        goto even; // jump to even 
    else
        goto odd; // jump to odd 
  
even: 
    cout << num << " is evenn"; 
    return; // return if even 
odd: 
    cout << num << " is oddn"; 
} 
  
// Driver program to test above function 
int main() 
{ 
    int num = 26; 
    checkEvenOrNot(num); 
    return 0; 
}
Structs āœ“
struct account {
  int account_number;
  char *first_name;
  char *last_name;
  float balance;
};
Comments āœ“
/* hello world */
// hi
Symbol Tables āœ“
// Declare an external function
extern double bar(double x);

// Define a public function
double foo(int count)
{
    double  sum = 0.0;

    // Sum all the values bar(1) to bar(count)
    for (int i = 1;  i <= count;  i++)
        sum += bar((double) i);
    return sum;
}
// Symbol Table:
// Symbol name|Type|Scope
// bar|function, double|extern
// x|double|function parameter
// foo|function, double|global
// count|int|function parameter
// sum|double|block local
// i|int|for-loop statement
Bitwise Operators āœ“
int i = 4; /* bit pattern equivalent is binary 100 */
int j = i << 2; /* makes it binary 10000, which multiplies the original number by 4 i.e. 16 */
Assert Statements āœ“
#include 
int i, a[10];
for (i = 0; i < 10; ++i)
  {
  assert(0 <= i && i < 10);
  a[i] = 10-i;
  }
for (i = 0; i < 10; ++i)
  {
  assert(0 <= i && i < 10);
  assert(0 <= a[i] && a[i] < 10);
  a[a[i]] = a[i];
  }
Strings āœ“
"hello world"
Pointers āœ“
int *ptr;
Ternary operators āœ“
#include 
int main(void) { printf("%d", 1 ? 1 : 0); }
Characters āœ“
char character = 'P';
Booleans āœ“
Enums āœ“
enum Gender {
  Male,
  Female,
};
Fixed Point Numbers X
Case Insensitive Identifiers X
Exceptions X
Classes X
Access Modifiers X
Semantic Indentation X
Operator Overloading X
Templates X
Multiple Inheritance X
Namespaces X
Garbage Collection X
Constructors X
Regular Expression Syntax Sugar X
Variable Substitution Syntax X

Books about C from ISBNdb

title authors year publisher
Introduction to Computing Systems: From Bits and Gates to C and Beyond Yale N. Patt and Sanjay J. Patel 2003 McGraw-Hill Education
The C Programming Language Brian W. Kernighan and Dennis M. Ritchie 1978 Prentice-Hall
Data Structures Using C and C++ (2nd Edition) Langsam, Yedidyah and Augenstein, Moshe J. and Tenenbaum, Aaron M. 1995 Pearson
Problem Solving and Program Design in C (7th Edition) Hanly, Jeri R. and Koffman, Elliot B. 2012 Pearson
Data Structures and Algorithm Analysis in C (2nd Edition) Weiss, Mark A. 1996 Pearson
C Programming for the Absolute Beginner Davenport, Keith and Vine, Michael 2014 Cengage Learning PTR
Standard C Library, The Plauger, P.J. 1992 Pearson
SPARC Architecture, Assembly Language Programming, and C Paul, Richard 1999 Pearson
System Programming with C and Unix Hoover, Adam 2009 Pearson
Expert C Programming: Deep C Secrets van der Linden, Peter 1994 Pearson
Book on C, A: Programming in C Kelley, Al and Pohl, Ira 1997 Addison-Wesley Professional
C for Java Programmers Muldner, Tomasz 2000 Pearson
Understanding and Using C Pointers: Core Techniques for Memory Management Reese, Richard M 2013 O'Reilly Media
C for Scientists and Engineers Johnsonbaugh, Richard and Kalin, Martin 2019 Pearson
Embedded C: Embedded C Pont, Michael 2002 Addison-Wesley Professional
Beginning C for Arduino, Second Edition: Learn C Programming for the Arduino Purdum, Jack 2015 Apress
C Programming for the Absolute Beginner Vine, Michael 2007 Cengage Learning PTR
Microcontrollers: From Assembly Language to C Using the Pic24 Family Reese, Robert B. and Bruce, J. W. and Jones, Bryan A. 2008 Charles River Media
C Programming for Arduino Bayle, Julien 2013 Packt Publishing
Engineering Problem Solving with C (3rd Edition) Etter, Delores M. 2004 Pearson
Absolute Beginner's Guide to C (2nd Edition) Perry, Greg 1994 Sams Publishing
C Programming Language: A Step by Step Beginner's Guide to Learn C Programming in 7 Days Graham, Darrel L. 2016 CreateSpace Independent Publishing Platform
Intermediate C Programming Lu, Yung-Hsiang 2015 CRC Press
C for Programmers with an Introduction to C11 (Deitel Developer Series): With an Introduction to C11 (Deitel Developer (Paperback)) Deitel, Paul 2013 Prentice Hall
C Programming: A Modern Approach King, K. N. and King, K.N. 1996 W W Norton & Co Inc
C Knights: An Introduction to Programming in C (with selections by Arup Guha and Ali Orooji) Pearson Learning Solutions
The Waite Group's New C Primer Plus Waite, Mitchell and Prata, Stephen 1993 Sams
Problem Solving and Program Design in C Plus MyLab Programming with Pearson eText -- Access Card Package Hanly, Jeri and Koffman, Elliot 2015 Pearson
Introduction to C Etter, Delores 1999 Pearson
Enough Rope to Shoot Yourself in the Foot: Rules for C and C++ Programming (Unix/C) Holub, Allen I. 1995 Computing McGraw-Hill
Programming In Ansi C E Balagurusamy 2022 Mc Graw Hill India
Programming in C 2/e (Oxford Higher Education) Dey, Pradip and Ghosh, Manas 2012 Oxford University Press
Crafting a Compiler with C Fischer, Charles and LeBlanc Jr., Richard 1991 Pearson
C Programming for Microcontrollers Featuring ATMEL's AVR Butterfly and the free WinAVR Compiler Pardue, Joe 2005 Smiley Micros
21st Century C: C Tips from the New School Klemens, Ben 2014 O'Reilly Media
C by Example (Cambridge Computer Science Texts, Series Number 29) Kalicharan, Noel 1994 Cambridge University Press
Black Art of 3D Game Programming: Writing Your Own High-Speed 3D Polygon Video Games in C Lamothe, Andre 1995 Waite Group Pr
Programming C On The Macintosh Terry A Ward 1986 Scott, Foresman
Let Us C Solutions Yashavant Kanetkar 2007 BPB Publications
C by Dissection: The Essentials of C Programming Kelley, Al and Pohl, Ira 1995 Addison-Wesley
C++ For C Programmers, Third Edition (3rd Edition) Pohl, Ira 1998 Addison-Wesley Professional
Numerical Recipes in C Press, W. H. and Flannery, B. P. and Teukolsky, S. A. and Vetterling, W. T. 1988 Cambridge University Press
C A Software Engineering Approach Darnell, Peter A. and Margolis, Philip E. 1996 Springer
Linux System Programming: Talking Directly to the Kernel and C Library Love, Robert 2007 O'Reilly Media
C Puzzle Book, The Feuer, Alan 2020 Addison-Wesley Professional
C++ The Core Language: A Foundation for C Programmers (Nutshell Handbooks) Brown, Doug and Satir, Gregory 1995 O'Reilly & Associates
Simulating Ecological and Evolutionary Systems in C Wilson, Will 2000 Cambridge University Press
Computing Fundamentals And C Programming 2Nd Edition BALAGURUSAMY 2017 MC GRAW HILL INDIA
Programming in C KOCHAN 2022 PEARSON INDIA
Computer Fundamentals & Programming in C Thareja, Reema 2012 Oxford University Press
Programming for Graphics Files: In C and C++ Levine, John R. and Levine, John 1994 Wiley
Programming in ANSI C Kumar, Ram; Agrawal, Rakesh 1992 West Publishing Company, College & School Division
Programming in Objective- C Cengage 2003 Thomson Delmar Learning
Parallel Programming In C With Mpi And Open Mp, 1St Edn QUINN 2011 MC GRAW HILL INDIA
ANSI C Programming BPB Publications
Introduction to C Programming Thareja, Reema 2013 Oxford University Press
Introduction to C Programming Thareja, Reema 2014 Oxford University Press
C Programming Faqs: Frequently Asked Questions Summit, Steve 1995 Addison-Wesley Professional
C Programming For Dummies (For Dummies (Computer/Tech)) Gookin, Dan 2020 For Dummies
Graphics Programming In Turbo C Leen Ammeraal 1989 Wiley
Let Us C: Authentic Guide to C PROGRAMMING Language 17th Edition (English Edition) Kanetkar, Yashavant 2020 BPB Publications
å¤§å­¦č®”ē®—ęœŗę•™č‚²äø›ä¹¦ā€¢CēØ‹åŗč®¾č®”čÆ­čØ€ä¹ é¢˜č§£ē­”(第2ē‰ˆ)(å½±å°ē‰ˆ) - The C Answer Book - Solutions to the Exercises in the C Programming Language - 2nd Edition 1997 Prentice Hall
Computer Concepts and C Programming VIKAS GUPTA 2009 Wiley India
The Art of C Programming Jones, Robin and Stewart, Ian 1986 Springer
Mylab Programming with Pearson Etext -- Access Code Card -- For Problem Solving and Program Design in C Hanly, Jeri and Koffman, Elliot 2015 Pearson
MyLab Programming with Pearson eText -- Standalone Access Card -- for C How to Program Deitel, Paul and Deitel, Harvey 2015 Pearson
C programming guide Purdum, Jack J 1985 Que Corp
Programming with C Hubbard, John 1996 McGraw Hill
21st Century C: C Tips from the New School Klemens, Ben 2012 O'Reilly Media
Data Structures and Program Design In C (2nd Edition) Kruse, Robert L. and Leung, Bruce P. and Tondo, Clovis L. 1996 Prentice Hall
Advanced Turbo C (Borland-Osborne/McGraw-Hill Programming Series) Schildt, Herbert 1989 McGraw-Hill Osborne Media
Data Structures Through C in Depth [May 30, 2004] Srivastava, S. K. and Srivastava, Deepali Srivastava, S. K. 2004 Bpb Publications
C language programming: a modern approach(Chinese Edition) ( MEI )K. N. King 2010 People Post Press Pub. Date: 2010 -04
Foundations of C /CLI Gordon Hogenson 20081020 Springer Nature
Programming in C (Hayden books C library) Kochan, Stephen G. 1988 Sams
Getting Graphic: Programming Fundamentals in C and C++/Book and Disk Finlay, Mark 1992 M & T Books
Starting Out with C From Control Structures to Objects Tony Gaddis 20140307 Pearson Education (US)
Business Programming in C for Dos-Based Systems (The Dryden Press Series in Information System) Millspaugh, A. C. 1992 Dryden Pr

Publications about C from Semantic Scholar

title authors year citations influentialCitations
The C Programming Language B. Kernighan and D. Ritchie 1978 2216 51
The Semantics of the C Programming Language Y. Gurevich and J. Huggins 1992 252 10
Hardbound: architectural support for spatial safety of the C programming language Joseph Devietti and Colin Blundell and Milo M. K. Martin and S. Zdancewic 2008 211 30
The concurrent C programming language N. Gehani and W. D. Roome 1989 84 1
UNIX time-sharing system: The C programming language D. Ritchie and S. C. Johnson and M. Lesk and B. Kernighan 1978 58 0
Real-time learning analytics for C programming language courses Xinyu Fu and Atsushi Shimada and H. Ogata and Yuta Taniguchi and D. Suehiro 2017 32 1
Introductory C Programming Language Learning with Game-Based Digital Learning Wen-Chih Chang and Yu-Min Chou 2008 24 3
C Programming: A Modern Approach K. N. King 1996 23 3
A minimal, extensible, drag-and-drop implementation of the C programming language S. Federici 2011 22 1
Omega—A Data Flow Analysis Tool for the C Programming Language C. Wilson and L. Osterweil 1985 20 1
The development of the C programming language D. Ritchie 1996 18 0
Extensions to the C programming language for enhanced fault detection D. Flater and Y. Yesha and E. Park 1993 17 1
Research and Reflection on Teaching of C Programming Language Design Hui Gao and Zhaowen Qiu and Di Wu and Liyan Gao 2015 12 0
A Serious Game for Learning C Programming Language Concepts Using Solo Taxonomy Alaeeddine Yassine and D. Chenouni and M. Berrada and A. Tahiri 2017 12 0
Timed C: An Extension to the C Programming Language for Real-Time Systems Saranya Natarajan and David Broman 2018 10 0
Design tradeoffs to support the C programming language in the CRISP microprocessor D. Ditzel and H. McLellan 1987 8 0
The C Programming Language and a C Compiler Ralph R. Ryan and Hans-Dieter Spiller 1985 7 0
Virtual Education System for the C Programming Language Il-Hyeon Moon and Saeron Han and KwanSun Choi and Dongsik Kim and Changwan Jeon and Sunheum Lee and Heunggu Jeon 2008 5 1
The C programming language Russell Jones 1985 2 0
javascript.html Ā· c.html Ā· python.html

View source

- Build the next great programming language Ā· Search Ā· Day 213 Ā· About Ā· Blog Ā· Acknowledgements Ā· Traffic Ā· Traffic Today Ā· GitHub Ā· feedback@pldb.com