0% found this document useful (0 votes)
92 views3 pages

C Cheat Sheet Expanded

This document is a cheat sheet for C programming, covering basic syntax, data types, operators, control statements, loops, functions, pointers, file handling, and standard libraries. It includes code examples for each section to illustrate usage. The cheat sheet serves as a quick reference for essential C programming concepts.

Uploaded by

raghubirkar11
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
92 views3 pages

C Cheat Sheet Expanded

This document is a cheat sheet for C programming, covering basic syntax, data types, operators, control statements, loops, functions, pointers, file handling, and standard libraries. It includes code examples for each section to illustrate usage. The cheat sheet serves as a quick reference for essential C programming concepts.

Uploaded by

raghubirkar11
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Java Cheat Sheet

C Cheat Sheet

1. Basic Syntax

#include <stdio.h>
int main() {
printf("Hello, World!\n");
return 0;
}

2. Data Types

int - Integer (e.g., 10)


float - Floating point (e.g., 10.5)
double - Double precision float
char - Single character (e.g., 'A')
void - No value

3. Operators

+ Addition
- Subtraction
* Multiplication
/ Division
% Modulus
== Equal to
!= Not equal to
>= Greater than or equal to
<= Less than or equal to

4. Control Statements

if (condition) {
// code block
} else {
Java Cheat Sheet

// another code block


}

switch(expression) {
case value1:
// code
break;
default:
// code
}

5. Loops

for (int i = 0; i < 10; i++) {


printf("%d\n", i);
}

while (condition) {
// loop body
}

6. Functions

int add(int a, int b) {


return a + b;
}

7. Pointers

int a = 10;
int *ptr = &a;
printf("%d", *ptr); // Prints value at address stored in ptr

8. File Handling

#include <stdio.h>
Java Cheat Sheet

FILE *fp = fopen("file.txt", "w");


fprintf(fp, "Hello, C");
fclose(fp);

9. Standard Libraries

#include <stdio.h> // Input-output functions


#include <stdlib.h> // Memory allocation, random numbers
#include <math.h> // Mathematical functions
#include <string.h> // String manipulation

You might also like