SlideShare uma empresa Scribd logo
1 de 10
Baixar para ler offline
C for Linux
                 Session 2 
               C Syntax

       BY:
       Eng.Riham AlDakkak
       System Administrator


                          
Getting Started

    What tools do I need to get started?
●


        gcc, text editor
    –

    Say hello to the world in C 
●


        Compilation and execution
    –

        A Closer look at the program 
    –




                                
A look at a C program structure
        General form of a C program is as 
    ●


            pre­processor directives
        –

            global declarations
        –

            main()
        –

            other functions
        –




                                    
Variables
        Variable declaration
    ●


            C is a static typing language 
        –

                 int x, y;
             ●


                 int x=0, y=1;  //initialization
             ●



            Language Predefined data types
        –

                 double, float
             ●


                 (signed, unsigned ) int, short, long, long long
             ●


                 char, unsigned char – ASCIIure
             ●




                                             
Variable Declaration: Continue
        Language Predefined data types
    ●


            Memory 
        –

        User defined types: typedef, structure
    ●




                               
Scopes
        Global Variables
    ●



        {} operator
    ●



        Example on scopes
    ●




                             
Operators

        Arithmetic (*, / ,% ,+ ,­ ,pre/post++, pre/post­­) 
    ●



        Relational (<,>,<=,>=,==,!=, !)
    ●



        Logical (&&, ||) and Bitwise (>> ,<< ,& ,^ ,| ,~ )
    ●



        Assignment (=,+=,­=,*=,/=,<<=,>>=, %=,|
    ●


        =,&=,^=)
        http://en.wikipedia.org/wiki/Operators_in_C_and
    ●


        _C++
                                  
Casting 
        Explicit cast
    ●


            char x = 'a'; int y = (int) x;
        –

            int x = 5; char y = (char) x;
        –

        Arithmetic Conversions
    ●


            Widening
        –

            Type balancing
        –

            Sign balancing
        –



                                        
Conditionals
        If statement
    ●



        switch statement
    ●



        ternary operator ?
    ●


            x=10;
        –

            y = x>9 ? 100:200;
        –




                                  
Loops

        for example
    ●



        while example
    ●



        do while example
    ●



        break and continue example (good point to 
    ●


        show infinite loop)



                               

Mais conteúdo relacionado

Semelhante a sysprog2 Part1

javascript teach
javascript teachjavascript teach
javascript teach
guest3732fa
 
JSBootcamp_White
JSBootcamp_WhiteJSBootcamp_White
JSBootcamp_White
guest3732fa
 
Jscript Fundamentals
Jscript FundamentalsJscript Fundamentals
Jscript Fundamentals
rspaike
 

Semelhante a sysprog2 Part1 (20)

PHP for Grown-ups
PHP for Grown-upsPHP for Grown-ups
PHP for Grown-ups
 
Maintainable JavaScript
Maintainable JavaScriptMaintainable JavaScript
Maintainable JavaScript
 
Bioinformatica p4-io
Bioinformatica p4-ioBioinformatica p4-io
Bioinformatica p4-io
 
Webcast 09/2008 - Silverlight 2 Beta 2
Webcast 09/2008 - Silverlight 2 Beta 2Webcast 09/2008 - Silverlight 2 Beta 2
Webcast 09/2008 - Silverlight 2 Beta 2
 
javascript teach
javascript teachjavascript teach
javascript teach
 
JSBootcamp_White
JSBootcamp_WhiteJSBootcamp_White
JSBootcamp_White
 
Scala + WattzOn, sitting in a tree....
Scala + WattzOn, sitting in a tree....Scala + WattzOn, sitting in a tree....
Scala + WattzOn, sitting in a tree....
 
Behaviour-Driven Development (BDD) em Python
Behaviour-Driven Development (BDD) em PythonBehaviour-Driven Development (BDD) em Python
Behaviour-Driven Development (BDD) em Python
 
Jscript Fundamentals
Jscript FundamentalsJscript Fundamentals
Jscript Fundamentals
 
L3 control
L3 controlL3 control
L3 control
 
clang-intro
clang-introclang-intro
clang-intro
 
05 Jo P May 07
05 Jo P May 0705 Jo P May 07
05 Jo P May 07
 
C C++ tutorial for beginners- tibacademy.in
C C++ tutorial for beginners- tibacademy.inC C++ tutorial for beginners- tibacademy.in
C C++ tutorial for beginners- tibacademy.in
 
Practical Groovy DSL
Practical Groovy DSLPractical Groovy DSL
Practical Groovy DSL
 
What Can Compilers Do for Us?
What Can Compilers Do for Us?What Can Compilers Do for Us?
What Can Compilers Do for Us?
 
Cpu
CpuCpu
Cpu
 
Python Workshop. LUG Maniapl
Python Workshop. LUG ManiaplPython Workshop. LUG Maniapl
Python Workshop. LUG Maniapl
 
Semi-automating Small-Scale Source Code Reuse via Structural Correspondence
Semi-automating Small-Scale Source Code Reuse via Structural CorrespondenceSemi-automating Small-Scale Source Code Reuse via Structural Correspondence
Semi-automating Small-Scale Source Code Reuse via Structural Correspondence
 
20 Jo P Aug 08
20 Jo P Aug 0820 Jo P Aug 08
20 Jo P Aug 08
 
Oh Crap, I Forgot (Or Never Learned) C! [CodeMash 2010]
Oh Crap, I Forgot (Or Never Learned) C! [CodeMash 2010]Oh Crap, I Forgot (Or Never Learned) C! [CodeMash 2010]
Oh Crap, I Forgot (Or Never Learned) C! [CodeMash 2010]
 

Mais de Ahmed Mekkawy

Virtualization Techniques & Cloud Compting
Virtualization Techniques & Cloud ComptingVirtualization Techniques & Cloud Compting
Virtualization Techniques & Cloud Compting
Ahmed Mekkawy
 
A look at computer security
A look at computer securityA look at computer security
A look at computer security
Ahmed Mekkawy
 
Networking in Gnu/Linux
Networking in Gnu/LinuxNetworking in Gnu/Linux
Networking in Gnu/Linux
Ahmed Mekkawy
 

Mais de Ahmed Mekkawy (20)

Encrypted Traffic in Egypt - an attempt to understand
Encrypted Traffic in Egypt - an attempt to understandEncrypted Traffic in Egypt - an attempt to understand
Encrypted Traffic in Egypt - an attempt to understand
 
Securing Governmental Public Services with Free/Open Source Tools - Egyptian ...
Securing Governmental Public Services with Free/Open Source Tools - Egyptian ...Securing Governmental Public Services with Free/Open Source Tools - Egyptian ...
Securing Governmental Public Services with Free/Open Source Tools - Egyptian ...
 
OpenData for governments
OpenData for governmentsOpenData for governments
OpenData for governments
 
Infrastructure as a Code
Infrastructure as a Code Infrastructure as a Code
Infrastructure as a Code
 
شركة سبيرولا للأنظمة والجمعية المصرية للمصادر المفتوحة
شركة سبيرولا للأنظمة والجمعية المصرية للمصادر المفتوحةشركة سبيرولا للأنظمة والجمعية المصرية للمصادر المفتوحة
شركة سبيرولا للأنظمة والجمعية المصرية للمصادر المفتوحة
 
Everything is a Game
Everything is a GameEverything is a Game
Everything is a Game
 
Why Cloud Computing has to go the FOSS way
Why Cloud Computing has to go the FOSS wayWhy Cloud Computing has to go the FOSS way
Why Cloud Computing has to go the FOSS way
 
FOSS Enterpreneurship
FOSS EnterpreneurshipFOSS Enterpreneurship
FOSS Enterpreneurship
 
Intro to FOSS & using it in development
Intro to FOSS & using it in developmentIntro to FOSS & using it in development
Intro to FOSS & using it in development
 
FOSS, history and philosophy
FOSS, history and philosophyFOSS, history and philosophy
FOSS, history and philosophy
 
Virtualization Techniques & Cloud Compting
Virtualization Techniques & Cloud ComptingVirtualization Techniques & Cloud Compting
Virtualization Techniques & Cloud Compting
 
A look at computer security
A look at computer securityA look at computer security
A look at computer security
 
Networking in Gnu/Linux
Networking in Gnu/LinuxNetworking in Gnu/Linux
Networking in Gnu/Linux
 
Foss Movement In Egypt
Foss Movement In EgyptFoss Movement In Egypt
Foss Movement In Egypt
 
Sysprog17
Sysprog17Sysprog17
Sysprog17
 
Sysprog 15
Sysprog 15Sysprog 15
Sysprog 15
 
Sysprog 9
Sysprog 9Sysprog 9
Sysprog 9
 
Sysprog 12
Sysprog 12Sysprog 12
Sysprog 12
 
Sysprog 14
Sysprog 14Sysprog 14
Sysprog 14
 
Sysprog 11
Sysprog 11Sysprog 11
Sysprog 11
 

Último

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Último (20)

Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 

sysprog2 Part1

  • 1. C for Linux Session 2  C Syntax BY: Eng.Riham AlDakkak System Administrator    
  • 2. Getting Started What tools do I need to get started? ● gcc, text editor – Say hello to the world in C  ● Compilation and execution – A Closer look at the program  –    
  • 3. A look at a C program structure General form of a C program is as  ● pre­processor directives – global declarations – main() – other functions –    
  • 4. Variables Variable declaration ● C is a static typing language  – int x, y; ● int x=0, y=1;  //initialization ● Language Predefined data types – double, float ● (signed, unsigned ) int, short, long, long long ● char, unsigned char – ASCIIure ●    
  • 5. Variable Declaration: Continue Language Predefined data types ● Memory  – User defined types: typedef, structure ●    
  • 6. Scopes Global Variables ● {} operator ● Example on scopes ●    
  • 7. Operators Arithmetic (*, / ,% ,+ ,­ ,pre/post++, pre/post­­)  ● Relational (<,>,<=,>=,==,!=, !) ● Logical (&&, ||) and Bitwise (>> ,<< ,& ,^ ,| ,~ ) ● Assignment (=,+=,­=,*=,/=,<<=,>>=, %=,| ● =,&=,^=) http://en.wikipedia.org/wiki/Operators_in_C_and ● _C++    
  • 8. Casting  Explicit cast ● char x = 'a'; int y = (int) x; – int x = 5; char y = (char) x; – Arithmetic Conversions ● Widening – Type balancing – Sign balancing –    
  • 9. Conditionals If statement ● switch statement ● ternary operator ? ● x=10; – y = x>9 ? 100:200; –    
  • 10. Loops for example ● while example ● do while example ● break and continue example (good point to  ● show infinite loop)