Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

C Cheat Sheet, Summaries of C programming

#include <stdio.h> void main(void) { int i = 1; unsigned u = 2; long l = 3; float f = 4.0; double d = 5.0; char c = 6; unsigned char uc = 7;.

Typology: Summaries

2021/2022

Uploaded on 08/05/2022

dirk88
dirk88 🇧🇪

4.5

(206)

3.2K documents

Partial preview of the text

Download C Cheat Sheet and more Summaries C programming in PDF only on Docsity! C Cheat Sheet Main Function void main(void) { } Printf #include <stdio.h> void main(void) { int i = 1; unsigned u = 2; long l = 3; float f = 4.0; double d = 5.0; char c = 6; unsigned char uc = 7; printf("i = %d, u = %u, l = %l, f = %f, d = %lf, c = %c, c = %d, uc = %d\n", i, u, l, f, d, c, c, uc); printf("print a tab by \t and new line by \n"); } Scanf #include <stdio.h> void main(void) { int i; printf("Print a prompt for i\n"); scanf("%d", &i); } Conditionals if(flag) { // put some statements here to execute if flag is true (flag != 0) } if(flag) { // put some statements here to execute if flag is true (flag != 0) } else { // put some statements here to execute if flag is false (flag == 0) } switch(flag) { case 0: // statements break; case 1: // statements break; case 2: // statements break; default: // statements }
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved