Open Source Flame
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Help
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # C Language cheat sheet **aim:** > 1. to add some value in our *resume* and show Teamwork our Skills to recruiter. > 2. this blog will help many first year students + learners > 3. this blog will uploaded on DEV.to So more people will interact > 4. this blog will help us to revise C in less time > 5. any of our team member can use this blog and this markdown but (fair credits should be given) plese find this [Link](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) or copy paste this url directly in your browser. **https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet** **please find this [Resource](https://kupdf.net/downloadFile/5985fac3dc0d609a11300d19) and TRY TO USE it!!! or write your OWN words.** # TOC + MAP > **Some words+motivation for Biginers Goes here!+** > **PDF Link to download(Putting first so pps can Download it)** # Hunaid Nakhuda <a name="hunaid-1"></a> # Introduction ## **Environment Setup** To set up your environment for C programming language, you need the following two software tools available on your computer, (a) Text Editor (b) The C Compiler. - [ ] Environment Setup - [ ] Program Structure # Variable:- variable names may consist of letters,digits,and the underscore(_) some rules to define variables:- 1.They must begin with a letter. Some system permit underscore as the first character. 2.ANSI standard recognizes a length of 3 charecters.However, length should not be normally more than eight characters. 3.Variable names are case sensitive. 4.It should not be a keyword. 5.White space is not allowed - [ ] Constant - [ ] Keywords - [ ] Data type - [ ] Printf ScanF - [ ] Operator # Dinky Lakhani - [ ] **If else** <!-- start writting from here --> There are numerous conditions that can be used to compare two variables and execute a certain piece of code based on the condition satisfied . Following are few conditions : | Particulars | Operators | | ------------- |:-------------:| | Equals | == | | Not Equal | != | | Greater than | a > b | | Less than | a < b | | Greater than or equal to | a >= b | | Less than or equal to | a <= b | These conditions can be used in several ways . One of which is using <span style="color:crimson;">```If-else```</span> statements. **If statement:** ``` int main() { int a = 5; int b = 20; if (b > a) printf("b is greater than a"); return 0; } ``` In the above code , if b is greater than a will be true and the output will be : ```b is greater than a``` **If - else if statement:** ``` int main() { int a = 5; int b = 5; if (b > a) printf("b is greater than a"); else if(a==b) printf("a is equal to b"); return 0; } ``` In the above example , the first condition turns out to be false and the control reaches to **```else if ```** statement . Thus , the output is ```a is equal to b``` **If - else statement:** ``` int main() { int a = 5; int b = 3; if (b > a) printf("b is greater than a"); else if(a==b) printf("a is equal to b"); else printf("a is greater than b"); return 0; } ``` In the above example , the first and the second condition turns out to be false and the control reaches to **```else```** statement . Thus , the output is ```a is greater than b``` - [ ] **Nested if** <!-- start writting from here --> If there is an ```if``` statement inside another **if** statement , it is known as nested if statement. **Nested If - else statement:** ``` int main() { int a = 5; int b = 3; int c = 10; if (a > b) { if(a>c) printf("Maximum is a = %d",a); else printf("Maximum is c = %d",c); } else { if(b>c) printf("Maximum is b = %d",b); else printf("Maximum is c = %d",c); } return 0; } ``` The output of the above code is : ``` Maximum is c = 10``` The first if condition is true so the control moves inside it and the nested if condition becomes false so the else condition is executed. - [ ] **Switch** <!-- start writting from here --> The switch statement is used to select one of the many blocks to be executed. ``` int main() { int month = 5; switch (month) { case 1: printf("January"); break; case 2: printf("February"); break; case 3: printf("March"); break; case 4: printf("April"); break; case 5: printf("May"); break; case 6: printf("June"); break; case 7: printf("July"); break; case 8: printf("August"); break; case 9: printf("September"); break; case 10: printf("October"); break; case 11: printf("November"); break; case 12: printf("December"); break; default: printf("Error"); exit(1); } } ``` The output of the above code is **```May```** In the above code , the switch statement evaluates the expression passed into its corresponding parenthesis. The output of the evaluation is used by the case . If there is a match in the case statements , the code following it is executed and the <span style="color:orange;">break</span> keyword helps in exit from the switch statement. Whereas, the <span style="color:green;">default</span> statement is executed if no match is found . **NOTE ``` Default statement must always be placed at the end of the switch statement.```** - [ ] **For loop** <!-- start writting from here --> When we know how many times a particular piece of code is to be repeatedly executed, the <span style="color:crimson;">for loop </span> is used. Its syntax is as follows : ``` for(expression 1 ; expression 2 ; expression 3) { //code to be repeatedly executed } ``` <u>*expression 1*</u> is called the initialization statement to set the beginning offset of the loop <u>*expression 2*</u> is called the test condition statement to check for the continuation of the loop . It is also known as the <u> **exit condition**</u>. <u>*expression 3*</u> is the statement that gets executed every time after the loop gets executed . It is usually an increment or decrement statement. For e.g. : ``` int main() { int i ; for(i=0;i<10;i++) { printf("%d",i); } return 0; } ``` The output of the above code is : **```0123456789```** The iterator i is initialised with 0 and the test condition is checked . 0 is printed and the value of i gets incremented . Now , the value is <span style="color:crimson;">i=1 </span> . As it is less than 10 , the printf statement gets executed. This process keeps on repeating until the value of i becomes 10. Since , 10 is not less than 10 , the loop stops. **<u>Infinite Loop</u>** If a user forgets to either increment/decrement the iterator or it forgets the exit condition , the loop gets repeated for an infinite number of times . This is an error and may sometimes crash the system. E.g. : ``` for(;;) { printf("hello world! "); } ``` Observe the loop carefully . None of the conditions are mentioned and thus it will print <span style="color:violet;">hello world! </span>for infinite time period till user explicitly stops the execution. - [ ] **While loop** <!-- start writting from here --> When we are not aware of the number of times the loop is to be repeated , the <span style="color:blue;">while</span> loop is used. While loop gets executed as long as the condition is true . **Remember** to initialize the iterator at the beginning of the while loop and to increment/decrement the iterator (for exitting the loop) inside the while loop (preferrably at the end of while loop). The syntax for the same is illustrated with an example as follows : ``` int main() { int i = 0 ; //initializing iterator while(i<10) //test condition { printf("%d",i); i++; //increment statement } return 0; } ``` The output of the above code is : **```0123456789```** **<u>Infinite Loop</u>** If the condition is always <span style="color:orange;">true </span> rather it never becomes **false**, the loop gets repeated for an infinite number of times . This is an error and may sometimes crash the system. E.g. : ``` char ch = 'a'; while(1) { printf("%c",ch); } ``` The condition following the while is always true i.e while it is 1 and thus it will print <span style="color:violet;">aaa....</span> infinite times till user explicitly stops the execution. - [ ] **Do while** <!-- start writting from here --> The <span style="color:aqua;">do while</span> is similar to while except that it gets executed atleast once before checking the condition and the loop is repeated as long as the condition is true. **Note** the semicolon at the end of the loop The syntax of the loop is illustrated with an example as follows: ``` int main() { int i = -1 ; //initializing iterator do { i++; //increment statement printf("%d",i); }while(i<0); //Test condition return 0; } ``` The output of the above piece of code will be : **```0```** - [ ] **Nested loop** <!-- start writting from here --> Sometimes called as <u>**"Loop inside Loop"**</u>. There can be any combination such as for loop inside another for loop , while inside while , do while inside another do while . There can also be hybrid nested loops i.e. while inside for and similar combinations . For e.g. : ``` int main() { for(int i=0;i<3;i++) { for(int j=0;j<3;j++) { printf("%d ",i*j); } printf("\n"); } return 0; } ``` The output will be : ``` 0 0 0 0 1 2 0 2 4 ``` ## Vivek Patel ## Array - An array is fixed-size sequenced collection of elements of same data type. - it is data structure that can stores a fixed-size sequential elements of same Data type. **Types of arrays** 1. One-dimentional arrays 2. Two-dimentional arrays 3. Multi-dimentional arrays //photo array variable and index One Dimentional arrays //Photo 1d arrays define : datatype array_name[size]; It must be a valid identifier and should follow veriable declaration rules ``` int a[99]; float point[20]; char name[50]; ``` * num is an array of type int, which can only store 99 elements of type int. * x is an array of type float, which can only store 20 elements of type float. * name is an array of type char, which can only store 50 elements of type char. - [ ] md array - [ ] typedef and #define - [ ] Function - [ ] String functions - [ ] Math functions ## SoumyaDeep Ghosh - [ ] Structure - [ ] Union - [ ] Enum - [ ] File handling - [ ] Graphics - [ ] Malloc and calloc again pdf, Credits here ,,Thanks,Final Words from team. Resources Used in blog : https://www.amazon.in/dp/B076Y39SHL/ref=cm_sw_em_r_mt_dp_502V7XH78C52KBEDGSV3?_encoding=UTF8&psc=1

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully